net/pkt: Remove _new suffix to net_pkt_write functions

Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-02-20 10:01:57 +01:00 committed by Kumar Gala
commit d6d52ce9e5
37 changed files with 128 additions and 131 deletions

View file

@ -128,7 +128,7 @@ static inline void rx_thread(void *ctx, void *unused1, void *unused2)
continue; continue;
} }
if (net_pkt_write_new(pkt, (void *)&msg, sizeof(msg))) { if (net_pkt_write(pkt, (void *)&msg, sizeof(msg))) {
LOG_ERR("Failed to append RX data"); LOG_ERR("Failed to append RX data");
net_pkt_unref(pkt); net_pkt_unref(pkt);
continue; continue;

View file

@ -93,7 +93,7 @@ static void eth_rx(struct device *dev)
goto error; goto error;
} }
if (net_pkt_write_new(pkt, (void *)context->rx_buf, frm_len)) { if (net_pkt_write(pkt, (void *)context->rx_buf, frm_len)) {
LOG_ERR("Failed to append RX buffer to context buffer"); LOG_ERR("Failed to append RX buffer to context buffer");
net_pkt_unref(pkt); net_pkt_unref(pkt);
goto error; goto error;

View file

@ -97,8 +97,8 @@ static struct net_pkt *e1000_rx(struct e1000_dev *dev)
goto out; goto out;
} }
if (net_pkt_write_new(pkt, INT_TO_POINTER((u32_t) dev->rx.addr), if (net_pkt_write(pkt, INT_TO_POINTER((u32_t) dev->rx.addr),
dev->rx.len - 4)) { dev->rx.len - 4)) {
LOG_ERR("Out of memory for received frame"); LOG_ERR("Out of memory for received frame");
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = NULL; pkt = NULL;

View file

@ -600,7 +600,7 @@ static void eth_rx(struct device *iface)
goto error; goto error;
} }
if (net_pkt_write_new(pkt, context->frame_buf, frame_length)) { if (net_pkt_write(pkt, context->frame_buf, frame_length)) {
irq_unlock(imask); irq_unlock(imask);
LOG_ERR("Unable to write frame into the pkt"); LOG_ERR("Unable to write frame into the pkt");
net_pkt_unref(pkt); net_pkt_unref(pkt);

View file

@ -249,7 +249,7 @@ static int read_data(struct eth_context *ctx, int fd)
return -ENOMEM; return -ENOMEM;
} }
if (net_pkt_write_new(pkt, ctx->recv, count)) { if (net_pkt_write(pkt, ctx->recv, count)) {
return -ENOBUFS; return -ENOBUFS;
} }

View file

@ -543,7 +543,7 @@ static int smsc_read_rx_fifo(struct net_pkt *pkt, u32_t len)
do { do {
buf32 = SMSC9220->RX_DATA_PORT; buf32 = SMSC9220->RX_DATA_PORT;
if (net_pkt_write_new(pkt, &buf32, sizeof(u32_t))) { if (net_pkt_write(pkt, &buf32, sizeof(u32_t))) {
return -1; return -1;
} }
} while (--len); } while (--len);

View file

@ -152,7 +152,7 @@ static struct net_pkt *eth_stellaris_rx_pkt(struct device *dev,
*/ */
count = 2; count = 2;
data = (u8_t *)&reg_val + 2; data = (u8_t *)&reg_val + 2;
if (net_pkt_write_new(pkt, data, count)) { if (net_pkt_write(pkt, data, count)) {
goto error; goto error;
} }
@ -164,7 +164,7 @@ static struct net_pkt *eth_stellaris_rx_pkt(struct device *dev,
reg_val = sys_read32(REG_MACDATA); reg_val = sys_read32(REG_MACDATA);
count = 4; count = 4;
data = (u8_t *)&reg_val; data = (u8_t *)&reg_val;
if (net_pkt_write_new(pkt, data, count)) { if (net_pkt_write(pkt, data, count)) {
goto error; goto error;
} }
} }
@ -182,7 +182,7 @@ static struct net_pkt *eth_stellaris_rx_pkt(struct device *dev,
count = bytes_left - 4; count = bytes_left - 4;
data = (u8_t *)&reg_val; data = (u8_t *)&reg_val;
if (net_pkt_write_new(pkt, data, count)) { if (net_pkt_write(pkt, data, count)) {
goto error; goto error;
} }

View file

@ -150,7 +150,7 @@ static struct net_pkt *eth_rx(struct device *dev)
goto release_desc; goto release_desc;
} }
if (net_pkt_write_new(pkt, dma_buffer, total_len)) { if (net_pkt_write(pkt, dma_buffer, total_len)) {
LOG_ERR("Failed to append RX buffer to context buffer"); LOG_ERR("Failed to append RX buffer to context buffer");
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = NULL; pkt = NULL;

View file

@ -100,7 +100,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
goto drop; goto drop;
} }
if (net_pkt_write_new(pkt, rx_frame->psdu + 1, pkt_len)) { if (net_pkt_write(pkt, rx_frame->psdu + 1, pkt_len)) {
goto drop; goto drop;
} }

View file

@ -857,7 +857,7 @@ static void on_cmd_sockread(struct net_buf **buf, u16_t len)
} }
if (i % 2) { if (i % 2) {
if (net_pkt_write_u8_new(sock->recv_pkt, c)) { if (net_pkt_write_u8(sock->recv_pkt, c)) {
LOG_ERR("Unable to add data! Aborting!"); LOG_ERR("Unable to add data! Aborting!");
net_pkt_unref(sock->recv_pkt); net_pkt_unref(sock->recv_pkt);
sock->recv_pkt = NULL; sock->recv_pkt = NULL;

View file

@ -93,7 +93,7 @@ static void eswifi_off_read_work(struct k_work *work)
goto done; goto done;
} }
if (!net_pkt_write_new(pkt, data, len)) { if (!net_pkt_write(pkt, data, len)) {
LOG_WRN("Incomplete buffer copy"); LOG_WRN("Incomplete buffer copy");
} }

View file

@ -2045,36 +2045,36 @@ int net_pkt_read_be32(struct net_pkt *pkt, u32_t *data);
* *
* @return 0 on success, negative errno code otherwise. * @return 0 on success, negative errno code otherwise.
*/ */
int net_pkt_write_new(struct net_pkt *pkt, const void *data, size_t length); int net_pkt_write(struct net_pkt *pkt, const void *data, size_t length);
/* Write u8_t data into a net_pkt. */ /* Write u8_t data into a net_pkt. */
static inline int net_pkt_write_u8_new(struct net_pkt *pkt, u8_t data) static inline int net_pkt_write_u8(struct net_pkt *pkt, u8_t data)
{ {
return net_pkt_write_new(pkt, &data, sizeof(u8_t)); return net_pkt_write(pkt, &data, sizeof(u8_t));
} }
/* Write u16_t big endian data into a net_pkt. */ /* Write u16_t big endian data into a net_pkt. */
static inline int net_pkt_write_be16_new(struct net_pkt *pkt, u16_t data) static inline int net_pkt_write_be16(struct net_pkt *pkt, u16_t data)
{ {
u16_t data_be16 = htons(data); u16_t data_be16 = htons(data);
return net_pkt_write_new(pkt, &data_be16, sizeof(u16_t)); return net_pkt_write(pkt, &data_be16, sizeof(u16_t));
} }
/* Write u32_t big endian data into a net_pkt. */ /* Write u32_t big endian data into a net_pkt. */
static inline int net_pkt_write_be32_new(struct net_pkt *pkt, u32_t data) static inline int net_pkt_write_be32(struct net_pkt *pkt, u32_t data)
{ {
u32_t data_be32 = htonl(data); u32_t data_be32 = htonl(data);
return net_pkt_write_new(pkt, &data_be32, sizeof(u32_t)); return net_pkt_write(pkt, &data_be32, sizeof(u32_t));
} }
/* Write u32_t little endian data into a net_pkt. */ /* Write u32_t little endian data into a net_pkt. */
static inline int net_pkt_write_le32_new(struct net_pkt *pkt, u32_t data) static inline int net_pkt_write_le32(struct net_pkt *pkt, u32_t data)
{ {
u32_t data_le32 = sys_cpu_to_le32(data); u32_t data_le32 = sys_cpu_to_le32(data);
return net_pkt_write_new(pkt, &data_le32, sizeof(u32_t)); return net_pkt_write(pkt, &data_le32, sizeof(u32_t));
} }
/** /**

View file

@ -226,8 +226,8 @@ static void send_data(u8_t *cfg, u8_t *data, size_t len)
LOG_DBG("queue pkt %p len %u", pkt, len); LOG_DBG("queue pkt %p len %u", pkt, len);
/* Add configuration id */ /* Add configuration id */
net_pkt_write_new(pkt, cfg, 2); net_pkt_write(pkt, cfg, 2);
net_pkt_write_new(pkt, data, len); net_pkt_write(pkt, data, len);
/* simulate LQI */ /* simulate LQI */
net_pkt_skip(pkt, 1); net_pkt_skip(pkt, 1);

View file

@ -314,14 +314,14 @@ static int wpanusb_vendor_handler(struct usb_setup_packet *setup,
return -ENOMEM; return -ENOMEM;
} }
net_pkt_write_u8_new(pkt, setup->bRequest); net_pkt_write_u8(pkt, setup->bRequest);
/* Add seq to TX */ /* Add seq to TX */
if (setup->bRequest == TX) { if (setup->bRequest == TX) {
net_pkt_write_u8_new(pkt, setup->wIndex); net_pkt_write_u8(pkt, setup->wIndex);
} }
net_pkt_write_new(pkt, *data, *len); net_pkt_write(pkt, *data, *len);
LOG_DBG("len %u seq %u", *len, setup->wIndex); LOG_DBG("len %u seq %u", *len, setup->wIndex);

View file

@ -62,8 +62,8 @@ static const char *dhcpv4_msg_type_name(enum dhcpv4_msg_type msg_type)
/* Add magic cookie to DCHPv4 messages */ /* Add magic cookie to DCHPv4 messages */
static inline bool dhcpv4_add_cookie(struct net_pkt *pkt) static inline bool dhcpv4_add_cookie(struct net_pkt *pkt)
{ {
if (net_pkt_write_new(pkt, (void *)magic_cookie, if (net_pkt_write(pkt, (void *)magic_cookie,
ARRAY_SIZE(magic_cookie))) { ARRAY_SIZE(magic_cookie))) {
return false; return false;
} }
@ -74,9 +74,9 @@ static inline bool dhcpv4_add_cookie(struct net_pkt *pkt)
static bool dhcpv4_add_option_length_value(struct net_pkt *pkt, u8_t option, static bool dhcpv4_add_option_length_value(struct net_pkt *pkt, u8_t option,
u8_t size, const void *value) u8_t size, const void *value)
{ {
if (net_pkt_write_u8_new(pkt, option) || if (net_pkt_write_u8(pkt, option) ||
net_pkt_write_u8_new(pkt, size) || net_pkt_write_u8(pkt, size) ||
net_pkt_write_new(pkt, value, size)) { net_pkt_write(pkt, value, size)) {
return false; return false;
} }
@ -120,7 +120,7 @@ static bool dhcpv4_add_req_ipaddr(struct net_pkt *pkt,
/* Add DHCPv4 Options end, rest of the message can be padded wit zeros */ /* Add DHCPv4 Options end, rest of the message can be padded wit zeros */
static inline bool dhcpv4_add_end(struct net_pkt *pkt) static inline bool dhcpv4_add_end(struct net_pkt *pkt)
{ {
if (net_pkt_write_u8_new(pkt, DHCPV4_OPTIONS_END)) { if (net_pkt_write_u8(pkt, DHCPV4_OPTIONS_END)) {
return false; return false;
} }

View file

@ -253,7 +253,7 @@ int net_icmpv6_send_error(struct net_pkt *orig, u8_t type, u8_t code,
/* Depending on error option, we store the param into the ICMP message. /* Depending on error option, we store the param into the ICMP message.
*/ */
if (type == NET_ICMPV6_PARAM_PROBLEM) { if (type == NET_ICMPV6_PARAM_PROBLEM) {
err = net_pkt_write_be32_new(pkt, param); err = net_pkt_write_be32(pkt, param);
} else { } else {
err = net_pkt_memset(pkt, 0, NET_ICMPV6_UNUSED_LEN); err = net_pkt_memset(pkt, 0, NET_ICMPV6_UNUSED_LEN);
} }

View file

@ -314,7 +314,7 @@ static void reassemble_packet(struct net_ipv6_reassembly *reass)
/* This one updates the previous header's nexthdr value */ /* This one updates the previous header's nexthdr value */
if (net_pkt_skip(pkt, net_pkt_ipv6_hdr_prev(pkt)) || if (net_pkt_skip(pkt, net_pkt_ipv6_hdr_prev(pkt)) ||
net_pkt_write_u8_new(pkt, next_hdr)) { net_pkt_write_u8(pkt, next_hdr)) {
goto error; goto error;
} }
@ -595,7 +595,7 @@ static int send_ipv6_fragment(struct net_pkt *pkt,
* Note that we insert the right next header to point to fragment header * Note that we insert the right next header to point to fragment header
*/ */
if (net_pkt_copy(frag_pkt, pkt, next_hdr_off) || if (net_pkt_copy(frag_pkt, pkt, next_hdr_off) ||
net_pkt_write_u8_new(frag_pkt, NET_IPV6_NEXTHDR_FRAG) || net_pkt_write_u8(frag_pkt, NET_IPV6_NEXTHDR_FRAG) ||
net_pkt_skip(pkt, 1) || net_pkt_skip(pkt, 1) ||
net_pkt_copy(frag_pkt, pkt, net_pkt_ip_hdr_len(pkt) + net_pkt_copy(frag_pkt, pkt, net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt) - next_hdr_off - 1)) { net_pkt_ipv6_ext_len(pkt) - next_hdr_off - 1)) {

View file

@ -63,9 +63,9 @@ static int mld_create(struct net_pkt *pkt,
if (num_sources > 0) { if (num_sources > 0) {
/* All source addresses, RFC 3810 ch 3 */ /* All source addresses, RFC 3810 ch 3 */
if (net_pkt_write_new(pkt, if (net_pkt_write(pkt,
net_ipv6_unspecified_address()->s6_addr, net_ipv6_unspecified_address()->s6_addr,
sizeof(struct in6_addr))) { sizeof(struct in6_addr))) {
return -ENOBUFS; return -ENOBUFS;
} }
} }
@ -89,8 +89,8 @@ static int mld_create_packet(struct net_pkt *pkt, u16_t count)
} }
/* Add hop-by-hop option and router alert option, RFC 3810 ch 5. */ /* Add hop-by-hop option and router alert option, RFC 3810 ch 5. */
if (net_pkt_write_u8_new(pkt, IPPROTO_ICMPV6) || if (net_pkt_write_u8(pkt, IPPROTO_ICMPV6) ||
net_pkt_write_u8_new(pkt, 0)) { net_pkt_write_u8(pkt, 0)) {
return -ENOBUFS; return -ENOBUFS;
} }
@ -99,9 +99,9 @@ static int mld_create_packet(struct net_pkt *pkt, u16_t count)
* - MLD (value 0) * - MLD (value 0)
* - 2 bytes of padding * - 2 bytes of padding
*/ */
if (net_pkt_write_be16_new(pkt, 0x0502) || if (net_pkt_write_be16(pkt, 0x0502) ||
net_pkt_write_be16_new(pkt, 0) || net_pkt_write_be16(pkt, 0) ||
net_pkt_write_be16_new(pkt, 0)) { net_pkt_write_be16(pkt, 0)) {
return -ENOBUFS; return -ENOBUFS;
} }
@ -111,8 +111,8 @@ static int mld_create_packet(struct net_pkt *pkt, u16_t count)
* MLDv6 stuff will come right after * MLDv6 stuff will come right after
*/ */
if (net_icmpv6_create(pkt, NET_ICMPV6_MLDv2, 0) || if (net_icmpv6_create(pkt, NET_ICMPV6_MLDv2, 0) ||
net_pkt_write_be16_new(pkt, 0) || net_pkt_write_be16(pkt, 0) ||
net_pkt_write_be16_new(pkt, count)) { net_pkt_write_be16(pkt, count)) {
return -ENOBUFS; return -ENOBUFS;
} }

View file

@ -881,9 +881,9 @@ static inline bool set_llao(struct net_pkt *pkt,
.len = llao_len >> 3, .len = llao_len >> 3,
}; };
if (net_pkt_write_new(pkt, &opt_hdr, if (net_pkt_write(pkt, &opt_hdr,
sizeof(struct net_icmpv6_nd_opt_hdr)) || sizeof(struct net_icmpv6_nd_opt_hdr)) ||
net_pkt_write_new(pkt, lladdr->addr, lladdr->len) || net_pkt_write(pkt, lladdr->addr, lladdr->len) ||
net_pkt_memset(pkt, 0, llao_len - lladdr->len - 2)) { net_pkt_memset(pkt, 0, llao_len - lladdr->len - 2)) {
return false; return false;
} }

View file

@ -1199,7 +1199,7 @@ static int context_setup_udp_packet(struct net_context *context,
return ret; return ret;
} }
ret = net_pkt_write_new(pkt, buf, len); ret = net_pkt_write(pkt, buf, len);
if (ret) { if (ret) {
return ret; return ret;
} }
@ -1408,7 +1408,7 @@ static int context_sendto(struct net_context *context,
ret = net_send_data(pkt); ret = net_send_data(pkt);
} else if (IS_ENABLED(CONFIG_NET_TCP) && } else if (IS_ENABLED(CONFIG_NET_TCP) &&
net_context_get_ip_proto(context) == IPPROTO_TCP) { net_context_get_ip_proto(context) == IPPROTO_TCP) {
ret = net_pkt_write_new(pkt, buf, len); ret = net_pkt_write(pkt, buf, len);
if (ret < 0) { if (ret < 0) {
goto fail; goto fail;
} }
@ -1422,7 +1422,7 @@ static int context_sendto(struct net_context *context,
ret = net_tcp_send_data(context, cb, token, user_data); ret = net_tcp_send_data(context, cb, token, user_data);
} else if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) && } else if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) &&
net_context_get_family(context) == AF_PACKET) { net_context_get_family(context) == AF_PACKET) {
ret = net_pkt_write_new(pkt, buf, len); ret = net_pkt_write(pkt, buf, len);
if (ret < 0) { if (ret < 0) {
goto fail; goto fail;
} }
@ -1433,7 +1433,7 @@ static int context_sendto(struct net_context *context,
} else if (IS_ENABLED(CONFIG_NET_SOCKETS_CAN) && } else if (IS_ENABLED(CONFIG_NET_SOCKETS_CAN) &&
net_context_get_family(context) == AF_CAN && net_context_get_family(context) == AF_CAN &&
net_context_get_ip_proto(context) == CAN_RAW) { net_context_get_ip_proto(context) == CAN_RAW) {
ret = net_pkt_write_new(pkt, buf, len); ret = net_pkt_write(pkt, buf, len);
if (ret < 0) { if (ret < 0) {
goto fail; goto fail;
} }

View file

@ -2008,7 +2008,7 @@ int net_pkt_read_be32(struct net_pkt *pkt, u32_t *data)
return ret; return ret;
} }
int net_pkt_write_new(struct net_pkt *pkt, const void *data, size_t length) int net_pkt_write(struct net_pkt *pkt, const void *data, size_t length)
{ {
NET_DBG("pkt %p data %p length %zu", pkt, data, length); NET_DBG("pkt %p data %p length %zu", pkt, data, length);
@ -2298,7 +2298,7 @@ int net_pkt_set_data(struct net_pkt *pkt,
return net_pkt_skip(pkt, access->size); return net_pkt_skip(pkt, access->size);
} }
return net_pkt_write_new(pkt, access->data, access->size); return net_pkt_write(pkt, access->data, access->size);
} }
void net_pkt_init(void) void net_pkt_init(void)

View file

@ -470,8 +470,7 @@ static int prepare_segment(struct net_tcp *tcp,
net_pkt_set_data(pkt, &tcp_access); net_pkt_set_data(pkt, &tcp_access);
if (optlen && if (optlen && net_pkt_write(pkt, segment->options, segment->optlen)) {
net_pkt_write_new(pkt, segment->options, segment->optlen)) {
goto fail; goto fail;
} }

View file

@ -575,9 +575,8 @@ struct net_pkt *gptp_prepare_announce(int port)
if (net_pkt_skip(pkt, sizeof(struct gptp_hdr) + if (net_pkt_skip(pkt, sizeof(struct gptp_hdr) +
sizeof(struct gptp_announce) - 8) || sizeof(struct gptp_announce) - 8) ||
net_pkt_write_new(pkt, net_pkt_write(pkt, &global_ds->path_trace.path_sequence[0][0],
&global_ds->path_trace.path_sequence[0][0], ntohs(global_ds->path_trace.len))) {
ntohs(global_ds->path_trace.len))) {
goto fail; goto fail;
} }

View file

@ -111,16 +111,16 @@ static int lldp_send(struct ethernet_lldp *lldp)
goto out; goto out;
} }
if (net_pkt_write_new(pkt, (u8_t *)lldp->lldpdu, if (net_pkt_write(pkt, (u8_t *)lldp->lldpdu,
sizeof(struct net_lldpdu))) { sizeof(struct net_lldpdu))) {
net_pkt_unref(pkt); net_pkt_unref(pkt);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
if (lldp->optional_du && lldp->optional_len) { if (lldp->optional_du && lldp->optional_len) {
if (!net_pkt_write_new(pkt, (u8_t *)lldp->optional_du, if (!net_pkt_write(pkt, (u8_t *)lldp->optional_du,
lldp->optional_len)) { lldp->optional_len)) {
net_pkt_unref(pkt); net_pkt_unref(pkt);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
@ -130,8 +130,7 @@ static int lldp_send(struct ethernet_lldp *lldp)
if (IS_ENABLED(CONFIG_NET_LLDP_END_LLDPDU_TLV_ENABLED)) { if (IS_ENABLED(CONFIG_NET_LLDP_END_LLDPDU_TLV_ENABLED)) {
u16_t tlv_end = htons(NET_LLDP_END_LLDPDU_VALUE); u16_t tlv_end = htons(NET_LLDP_END_LLDPDU_VALUE);
if (!net_pkt_write_new(pkt, (u8_t *)&tlv_end, if (!net_pkt_write(pkt, (u8_t *)&tlv_end, sizeof(tlv_end))) {
sizeof(tlv_end))) {
net_pkt_unref(pkt); net_pkt_unref(pkt);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;

View file

@ -303,7 +303,7 @@ static void ecm_read_cb(u8_t ep, int size, void *priv)
goto done; goto done;
} }
if (net_pkt_write_new(pkt, rx_buf, size)) { if (net_pkt_write(pkt, rx_buf, size)) {
LOG_ERR("Unable to write into pkt\n"); LOG_ERR("Unable to write into pkt\n");
net_pkt_unref(pkt); net_pkt_unref(pkt);
goto done; goto done;

View file

@ -182,7 +182,7 @@ static void eem_read_cb(u8_t ep, int size, void *priv)
} }
/* copy payload and discard 32-bit sentinel */ /* copy payload and discard 32-bit sentinel */
if (net_pkt_write_new(pkt, ptr, eem_size - 4)) { if (net_pkt_write(pkt, ptr, eem_size - 4)) {
LOG_ERR("Unable to write into pkt\n"); LOG_ERR("Unable to write into pkt\n");
net_pkt_unref(pkt); net_pkt_unref(pkt);
break; break;

View file

@ -408,8 +408,8 @@ static void rndis_bulk_out(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
rndis.in_pkt = pkt; rndis.in_pkt = pkt;
} }
if (net_pkt_write_new(rndis.in_pkt, if (net_pkt_write(rndis.in_pkt,
buffer + hdr_offset, len - hdr_offset)) { buffer + hdr_offset, len - hdr_offset)) {
LOG_ERR("Error writing data to pkt: %p", rndis.in_pkt); LOG_ERR("Error writing data to pkt: %p", rndis.in_pkt);
rndis_clean(); rndis_clean();
rndis.rx_err++; rndis.rx_err++;

View file

@ -213,16 +213,16 @@ struct net_pkt *prepare_dhcp_offer(struct net_if *iface, u32_t xid)
goto fail; goto fail;
} }
if (net_pkt_write_new(pkt, offer, 4)) { if (net_pkt_write(pkt, offer, 4)) {
goto fail; goto fail;
} }
/* Update xid from the client request */ /* Update xid from the client request */
if (net_pkt_write_be32_new(pkt, xid)) { if (net_pkt_write_be32(pkt, xid)) {
goto fail; goto fail;
} }
if (net_pkt_write_new(pkt, offer + 8, sizeof(offer) - 8)) { if (net_pkt_write(pkt, offer + 8, sizeof(offer) - 8)) {
goto fail; goto fail;
} }
@ -254,16 +254,16 @@ struct net_pkt *prepare_dhcp_ack(struct net_if *iface, u32_t xid)
goto fail; goto fail;
} }
if (net_pkt_write_new(pkt, ack, 4)) { if (net_pkt_write(pkt, ack, 4)) {
goto fail; goto fail;
} }
/* Update xid from the client request */ /* Update xid from the client request */
if (net_pkt_write_be32_new(pkt, xid)) { if (net_pkt_write_be32(pkt, xid)) {
goto fail; goto fail;
} }
if (net_pkt_write_new(pkt, ack + 8, sizeof(ack) - 8)) { if (net_pkt_write(pkt, ack + 8, sizeof(ack) - 8)) {
goto fail; goto fail;
} }

View file

@ -105,7 +105,7 @@ void test_icmpv6(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
net_pkt_write_new(pkt, icmpv6_inval_chksum, ICMPV6_MSG_SIZE); net_pkt_write(pkt, icmpv6_inval_chksum, ICMPV6_MSG_SIZE);
hdr = (struct net_ipv6_hdr *)pkt->buffer->data; hdr = (struct net_ipv6_hdr *)pkt->buffer->data;
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
@ -123,7 +123,7 @@ void test_icmpv6(void)
net_pkt_set_overwrite(pkt, false); net_pkt_set_overwrite(pkt, false);
pkt->buffer->len = 0; pkt->buffer->len = 0;
net_pkt_write_new(pkt, icmpv6_echo_rep, ICMPV6_MSG_SIZE); net_pkt_write(pkt, icmpv6_echo_rep, ICMPV6_MSG_SIZE);
hdr = (struct net_ipv6_hdr *)pkt->buffer->data; hdr = (struct net_ipv6_hdr *)pkt->buffer->data;
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
@ -142,7 +142,7 @@ void test_icmpv6(void)
net_pkt_set_overwrite(pkt, false); net_pkt_set_overwrite(pkt, false);
pkt->buffer->len = 0; pkt->buffer->len = 0;
net_pkt_write_new(pkt, icmpv6_echo_req, ICMPV6_MSG_SIZE); net_pkt_write(pkt, icmpv6_echo_req, ICMPV6_MSG_SIZE);
hdr = (struct net_ipv6_hdr *)pkt->buffer->data; hdr = (struct net_ipv6_hdr *)pkt->buffer->data;
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);

View file

@ -428,7 +428,7 @@ static bool send_iface(struct net_if *iface, int val, bool expect_fail)
return false; return false;
} }
net_pkt_write_new(pkt, data, sizeof(data)); net_pkt_write(pkt, data, sizeof(data));
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
ret = net_send_data(pkt); ret = net_send_data(pkt);

View file

@ -187,8 +187,8 @@ static void prepare_ra_message(struct net_pkt *pkt)
net_pkt_set_overwrite(pkt, false); net_pkt_set_overwrite(pkt, false);
net_pkt_write_new(pkt, &hdr, sizeof(struct net_eth_hdr)); net_pkt_write(pkt, &hdr, sizeof(struct net_eth_hdr));
net_pkt_write_new(pkt, icmpv6_ra, sizeof(icmpv6_ra)); net_pkt_write(pkt, icmpv6_ra, sizeof(icmpv6_ra));
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
} }
@ -455,7 +455,7 @@ static void test_send_ns_extra_options(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, icmpv6_ns_invalid, sizeof(icmpv6_ns_invalid)); net_pkt_write(pkt, icmpv6_ns_invalid, sizeof(icmpv6_ns_invalid));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
zassert_false((net_recv_data(iface, pkt) < 0), zassert_false((net_recv_data(iface, pkt) < 0),
@ -478,7 +478,7 @@ static void test_send_ns_no_options(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, icmpv6_ns_no_sllao, sizeof(icmpv6_ns_no_sllao)); net_pkt_write(pkt, icmpv6_ns_no_sllao, sizeof(icmpv6_ns_no_sllao));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
zassert_false((net_recv_data(iface, pkt) < 0), zassert_false((net_recv_data(iface, pkt) < 0),
@ -594,7 +594,7 @@ static void test_hbho_message(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, ipv6_hbho, sizeof(ipv6_hbho)); net_pkt_write(pkt, ipv6_hbho, sizeof(ipv6_hbho));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
zassert_false(net_recv_data(iface, pkt) < 0, zassert_false(net_recv_data(iface, pkt) < 0,
@ -645,7 +645,7 @@ static void test_hbho_message_1(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, ipv6_hbho_1, sizeof(ipv6_hbho_1)); net_pkt_write(pkt, ipv6_hbho_1, sizeof(ipv6_hbho_1));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
@ -706,7 +706,7 @@ static void test_hbho_message_2(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, ipv6_hbho_2, sizeof(ipv6_hbho_2)); net_pkt_write(pkt, ipv6_hbho_2, sizeof(ipv6_hbho_2));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
zassert_false(net_recv_data(iface, pkt) < 0, zassert_false(net_recv_data(iface, pkt) < 0,
@ -868,7 +868,7 @@ static void test_hbho_message_3(void)
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
net_pkt_write_new(pkt, ipv6_hbho_3, sizeof(ipv6_hbho_3)); net_pkt_write(pkt, ipv6_hbho_3, sizeof(ipv6_hbho_3));
net_pkt_lladdr_clear(pkt); net_pkt_lladdr_clear(pkt);
zassert_false(net_recv_data(iface, pkt) < 0, zassert_false(net_recv_data(iface, pkt) < 0,

View file

@ -1230,7 +1230,7 @@ static void test_find_last_ipv6_fragment_udp(void)
sizeof(struct net_ipv6_hdr)); sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + UDP */ /* Add IPv6 header + UDP */
ret = net_pkt_write_new(pkt, ipv6_udp, sizeof(ipv6_udp)); ret = net_pkt_write(pkt, ipv6_udp, sizeof(ipv6_udp));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
@ -1264,7 +1264,7 @@ static void test_find_last_ipv6_fragment_hbho_udp(void)
net_pkt_set_ipv6_ext_len(pkt, sizeof(ipv6_hbho) - net_pkt_set_ipv6_ext_len(pkt, sizeof(ipv6_hbho) -
sizeof(struct net_ipv6_hdr)); sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option */ /* Add IPv6 header + HBH option */
ret = net_pkt_write_new(pkt, ipv6_hbho, sizeof(ipv6_hbho)); ret = net_pkt_write(pkt, ipv6_hbho, sizeof(ipv6_hbho));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
ret = net_ipv6_find_last_ext_hdr(pkt, &next_hdr_pos, &last_hdr_pos); ret = net_ipv6_find_last_ext_hdr(pkt, &next_hdr_pos, &last_hdr_pos);
@ -1299,7 +1299,7 @@ static void test_find_last_ipv6_fragment_hbho_1(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option + fragment header */ /* Add IPv6 header + HBH option + fragment header */
ret = net_pkt_write_new(pkt, ipv6_hbho_1, sizeof(ipv6_hbho_1)); ret = net_pkt_write(pkt, ipv6_hbho_1, sizeof(ipv6_hbho_1));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);
@ -1342,7 +1342,7 @@ static void test_find_last_ipv6_fragment_hbho_2(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option + fragment header */ /* Add IPv6 header + HBH option + fragment header */
ret = net_pkt_write_new(pkt, ipv6_hbho_2, sizeof(ipv6_hbho_2)); ret = net_pkt_write(pkt, ipv6_hbho_2, sizeof(ipv6_hbho_2));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);
@ -1385,7 +1385,7 @@ static void test_find_last_ipv6_fragment_hbho_3(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option + fragment header */ /* Add IPv6 header + HBH option + fragment header */
ret = net_pkt_write_new(pkt, ipv6_hbho_3, sizeof(ipv6_hbho_3)); ret = net_pkt_write(pkt, ipv6_hbho_3, sizeof(ipv6_hbho_3));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);
@ -1426,7 +1426,7 @@ static void test_find_last_ipv6_fragment_hbho_frag(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option + fragment header */ /* Add IPv6 header + HBH option + fragment header */
ret = net_pkt_write_new(pkt, ipv6_hbho_frag, sizeof(ipv6_hbho_frag)); ret = net_pkt_write(pkt, ipv6_hbho_frag, sizeof(ipv6_hbho_frag));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);
@ -1463,8 +1463,8 @@ static void test_find_last_ipv6_fragment_hbho_frag_1(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
/* Add IPv6 header + HBH option + fragment header */ /* Add IPv6 header + HBH option + fragment header */
ret = net_pkt_write_new(pkt, ipv6_hbho_frag_1, ret = net_pkt_write(pkt, ipv6_hbho_frag_1,
sizeof(ipv6_hbho_frag_1)); sizeof(ipv6_hbho_frag_1));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);
@ -1515,12 +1515,12 @@ static void test_send_ipv6_fragment(void)
net_pkt_set_ipv6_ext_len(pkt, 8); /* hbho */ net_pkt_set_ipv6_ext_len(pkt, 8); /* hbho */
/* Add IPv6 header + HBH option */ /* Add IPv6 header + HBH option */
ret = net_pkt_write_new(pkt, ipv6_hbho, sizeof(ipv6_hbho)); ret = net_pkt_write(pkt, ipv6_hbho, sizeof(ipv6_hbho));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
/* Then add some data that is over 1280 bytes long */ /* Then add some data that is over 1280 bytes long */
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
ret = net_pkt_write_new(pkt, data, data_len); ret = net_pkt_write(pkt, data, data_len);
zassert_true(ret == 0, "Cannot append data"); zassert_true(ret == 0, "Cannot append data");
@ -1577,7 +1577,7 @@ static void test_send_ipv6_fragment_large_hbho(void)
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr)); net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv6_hdr));
net_pkt_set_ipv6_ext_len(pkt, 1032); /* hbho */ net_pkt_set_ipv6_ext_len(pkt, 1032); /* hbho */
ret = net_pkt_write_new(pkt, ipv6_large_hbho, sizeof(ipv6_large_hbho)); ret = net_pkt_write(pkt, ipv6_large_hbho, sizeof(ipv6_large_hbho));
zassert_true(ret == 0, "IPv6 header append failed"); zassert_true(ret == 0, "IPv6 header append failed");
net_pkt_set_overwrite(pkt, true); net_pkt_set_overwrite(pkt, true);

View file

@ -333,33 +333,33 @@ static void send_query(struct net_if *iface)
net_ipv6_create(pkt, &peer_addr, &dst); net_ipv6_create(pkt, &peer_addr, &dst);
/* Add hop-by-hop option and router alert option, RFC 3810 ch 5. */ /* Add hop-by-hop option and router alert option, RFC 3810 ch 5. */
net_pkt_write_u8_new(pkt, IPPROTO_ICMPV6); net_pkt_write_u8(pkt, IPPROTO_ICMPV6);
net_pkt_write_u8_new(pkt, 0); /* length (0 means 8 bytes) */ net_pkt_write_u8(pkt, 0); /* length (0 means 8 bytes) */
#define ROUTER_ALERT_LEN 8 #define ROUTER_ALERT_LEN 8
/* IPv6 router alert option is described in RFC 2711. */ /* IPv6 router alert option is described in RFC 2711. */
net_pkt_write_be16_new(pkt, 0x0502); /* RFC 2711 ch 2.1 */ net_pkt_write_be16(pkt, 0x0502); /* RFC 2711 ch 2.1 */
net_pkt_write_be16_new(pkt, 0); /* pkt contains MLD msg */ net_pkt_write_be16(pkt, 0); /* pkt contains MLD msg */
net_pkt_write_u8_new(pkt, 1); /* padn */ net_pkt_write_u8(pkt, 1); /* padn */
net_pkt_write_u8_new(pkt, 0); /* padn len */ net_pkt_write_u8(pkt, 0); /* padn len */
net_pkt_set_ipv6_ext_len(pkt, ROUTER_ALERT_LEN); net_pkt_set_ipv6_ext_len(pkt, ROUTER_ALERT_LEN);
/* ICMPv6 header */ /* ICMPv6 header */
net_icmpv6_create(pkt, NET_ICMPV6_MLD_QUERY, 0); net_icmpv6_create(pkt, NET_ICMPV6_MLD_QUERY, 0);
net_pkt_write_be16_new(pkt, 3); /* maximum response code */ net_pkt_write_be16(pkt, 3); /* maximum response code */
net_pkt_write_be16_new(pkt, 0); /* reserved field */ net_pkt_write_be16(pkt, 0); /* reserved field */
net_pkt_set_ipv6_next_hdr(pkt, NET_IPV6_NEXTHDR_HBHO); net_pkt_set_ipv6_next_hdr(pkt, NET_IPV6_NEXTHDR_HBHO);
net_pkt_write_be16_new(pkt, 0); /* Resv, S, QRV and QQIC */ net_pkt_write_be16(pkt, 0); /* Resv, S, QRV and QQIC */
net_pkt_write_be16_new(pkt, 0); /* number of addresses */ net_pkt_write_be16(pkt, 0); /* number of addresses */
net_pkt_write_new(pkt, net_ipv6_unspecified_address(), net_pkt_write(pkt, net_ipv6_unspecified_address(),
sizeof(struct in6_addr)); sizeof(struct in6_addr));
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
net_ipv6_finalize(pkt, IPPROTO_ICMPV6); net_ipv6_finalize(pkt, IPPROTO_ICMPV6);

View file

@ -227,19 +227,19 @@ static void test_net_pkt_basics_of_rw(void)
/* Let's subsequently write 1 byte, then 2 bytes and 4 bytes /* Let's subsequently write 1 byte, then 2 bytes and 4 bytes
* We write values made of 0s * We write values made of 0s
*/ */
ret = net_pkt_write_u8_new(pkt, 0); ret = net_pkt_write_u8(pkt, 0);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
/* Length should be 1 now */ /* Length should be 1 now */
zassert_true(net_pkt_get_len(pkt) == 1, "Pkt length mismatch"); zassert_true(net_pkt_get_len(pkt) == 1, "Pkt length mismatch");
ret = net_pkt_write_be16_new(pkt, 0); ret = net_pkt_write_be16(pkt, 0);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
/* Length should be 3 now */ /* Length should be 3 now */
zassert_true(net_pkt_get_len(pkt) == 3, "Pkt length mismatch"); zassert_true(net_pkt_get_len(pkt) == 3, "Pkt length mismatch");
ret = net_pkt_write_be32_new(pkt, 0); ret = net_pkt_write_be32(pkt, 0);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
/* Length should be 7 now */ /* Length should be 7 now */
@ -248,7 +248,7 @@ static void test_net_pkt_basics_of_rw(void)
/* All these writing functions use net_ptk_write(), which works /* All these writing functions use net_ptk_write(), which works
* this way: * this way:
*/ */
ret = net_pkt_write_new(pkt, small_buffer, 9); ret = net_pkt_write(pkt, small_buffer, 9);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
/* Length should be 16 now */ /* Length should be 16 now */
@ -315,7 +315,7 @@ static void test_net_pkt_basics_of_rw(void)
zassert_true(net_pkt_get_len(pkt) == 40, "Pkt length mismatch"); zassert_true(net_pkt_get_len(pkt) == 40, "Pkt length mismatch");
/* And you can write stuff */ /* And you can write stuff */
ret = net_pkt_write_le32_new(pkt, 0); ret = net_pkt_write_le32(pkt, 0);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
/* Again, length should _still_ be 40 */ /* Again, length should _still_ be 40 */
@ -334,7 +334,7 @@ static void test_net_pkt_basics_of_rw(void)
* This is completely nominal, as being set, overwrite allows r/w only * This is completely nominal, as being set, overwrite allows r/w only
* on existing data in the buffer: * on existing data in the buffer:
*/ */
ret = net_pkt_write_be32_new(pkt, 0); ret = net_pkt_write_be32(pkt, 0);
zassert_true(ret != 0, "Pkt write succeeded where it shouldn't have"); zassert_true(ret != 0, "Pkt write succeeded where it shouldn't have");
/* Logically, in order to be able to add new data in the buffer, /* Logically, in order to be able to add new data in the buffer,
@ -343,7 +343,7 @@ static void test_net_pkt_basics_of_rw(void)
net_pkt_set_overwrite(pkt, false); net_pkt_set_overwrite(pkt, false);
/* But it will fail: */ /* But it will fail: */
ret = net_pkt_write_le32_new(pkt, 0); ret = net_pkt_write_le32(pkt, 0);
zassert_true(ret != 0, "Pkt write succeeded?"); zassert_true(ret != 0, "Pkt write succeeded?");
/* Why is that? /* Why is that?
@ -380,7 +380,7 @@ void test_net_pkt_advanced_basics(void)
* and back again to your previous position? * and back again to your previous position?
* You could certainly do: * You could certainly do:
*/ */
ret = net_pkt_write_new(pkt, small_buffer, 20); ret = net_pkt_write(pkt, small_buffer, 20);
zassert_true(ret == 0, "Pkt write failed"); zassert_true(ret == 0, "Pkt write failed");
pkt_print_cursor(pkt); pkt_print_cursor(pkt);

View file

@ -350,7 +350,7 @@ static void _recv_data(struct net_if *iface, struct net_pkt **pkt)
*pkt = net_pkt_rx_alloc_with_buffer(iface, sizeof(data), *pkt = net_pkt_rx_alloc_with_buffer(iface, sizeof(data),
AF_UNSPEC, 0, K_FOREVER); AF_UNSPEC, 0, K_FOREVER);
net_pkt_write_new(*pkt, data, sizeof(data)); net_pkt_write(*pkt, data, sizeof(data));
ret = net_recv_data(iface, *pkt); ret = net_recv_data(iface, *pkt);
zassert_equal(ret, 0, "Data receive failure"); zassert_equal(ret, 0, "Data receive failure");

View file

@ -358,8 +358,8 @@ static struct net_pkt *setup_ipv6_tcp(struct net_if *iface,
tcp_hdr.src_port = htons(remote_port); tcp_hdr.src_port = htons(remote_port);
tcp_hdr.dst_port = htons(local_port); tcp_hdr.dst_port = htons(local_port);
net_pkt_write_new(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr)); net_pkt_write(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr));
net_pkt_write_new(pkt, data, sizeof(data)); net_pkt_write(pkt, data, sizeof(data));
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
net_ipv6_finalize(pkt, IPPROTO_TCP); net_ipv6_finalize(pkt, IPPROTO_TCP);
@ -387,8 +387,8 @@ static struct net_pkt *setup_ipv4_tcp(struct net_if *iface,
tcp_hdr.src_port = htons(remote_port); tcp_hdr.src_port = htons(remote_port);
tcp_hdr.dst_port = htons(local_port); tcp_hdr.dst_port = htons(local_port);
net_pkt_write_new(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr)); net_pkt_write(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr));
net_pkt_write_new(pkt, data, sizeof(data)); net_pkt_write(pkt, data, sizeof(data));
net_pkt_cursor_init(pkt); net_pkt_cursor_init(pkt);
net_ipv4_finalize(pkt, IPPROTO_TCP); net_ipv4_finalize(pkt, IPPROTO_TCP);
@ -442,16 +442,16 @@ static struct net_pkt *setup_ipv6_tcp_long(struct net_if *iface,
net_pkt_set_ipv6_hop_limit(pkt, 255); net_pkt_set_ipv6_hop_limit(pkt, 255);
net_ipv6_create(pkt, remote_addr, local_addr); net_ipv6_create(pkt, remote_addr, local_addr);
net_pkt_write_new(pkt, ipv6_hop_by_hop_ext_hdr, net_pkt_write(pkt, ipv6_hop_by_hop_ext_hdr,
sizeof(ipv6_hop_by_hop_ext_hdr)); sizeof(ipv6_hop_by_hop_ext_hdr));
net_pkt_set_ipv6_ext_len(pkt, sizeof(ipv6_hop_by_hop_ext_hdr)); net_pkt_set_ipv6_ext_len(pkt, sizeof(ipv6_hop_by_hop_ext_hdr));
tcp_hdr.src_port = htons(remote_port); tcp_hdr.src_port = htons(remote_port);
tcp_hdr.dst_port = htons(local_port); tcp_hdr.dst_port = htons(local_port);
net_pkt_write_new(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr)); net_pkt_write(pkt, &tcp_hdr, sizeof(struct net_tcp_hdr));
net_pkt_write_new(pkt, data, sizeof(data)); net_pkt_write(pkt, data, sizeof(data));
net_pkt_set_ipv6_next_hdr(pkt, 0); /* hop-by-hop option */ net_pkt_set_ipv6_next_hdr(pkt, 0); /* hop-by-hop option */

View file

@ -297,7 +297,7 @@ static bool send_ipv6_udp_long_msg(struct net_if *iface,
zassert_true(0, "exiting"); zassert_true(0, "exiting");
} }
if (net_pkt_write_new(pkt, (u8_t *)ipv6_hop_by_hop_ext_hdr, if (net_pkt_write(pkt, (u8_t *)ipv6_hop_by_hop_ext_hdr,
sizeof(ipv6_hop_by_hop_ext_hdr))) { sizeof(ipv6_hop_by_hop_ext_hdr))) {
printk("Cannot write IPv6 ext header pkt %p", pkt); printk("Cannot write IPv6 ext header pkt %p", pkt);
zassert_true(0, "exiting"); zassert_true(0, "exiting");
@ -308,7 +308,7 @@ static bool send_ipv6_udp_long_msg(struct net_if *iface,
zassert_true(0, "exiting"); zassert_true(0, "exiting");
} }
if (net_pkt_write_new(pkt, (u8_t *)payload, sizeof(payload))) { if (net_pkt_write(pkt, (u8_t *)payload, sizeof(payload))) {
printk("Cannot write IPv6 ext header pkt %p", pkt); printk("Cannot write IPv6 ext header pkt %p", pkt);
zassert_true(0, "exiting"); zassert_true(0, "exiting");
} }