net/ipv4: Move autoconf to new net_pkt API

Only the allocator needed to be changed here.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-01-11 12:05:16 +01:00 committed by Jukka Rissanen
parent e04914a963
commit a9dd6256a4

View File

@ -33,32 +33,21 @@ static struct net_pkt *ipv4_autoconf_prepare_arp(struct net_if *iface)
{
struct net_if_config *cfg = net_if_get_config(iface);
struct net_pkt *pkt;
struct net_buf *frag;
pkt = net_pkt_get_reserve_tx(BUF_ALLOC_TIMEOUT);
/* We provide AF_UNSPEC to the allocator: this packet does not
* need space for any IPv4 header.
*/
pkt = net_pkt_alloc_with_buffer(iface, sizeof(struct net_arp_hdr),
AF_UNSPEC, 0, BUF_ALLOC_TIMEOUT);
if (!pkt) {
goto fail;
return NULL;
}
frag = net_pkt_get_frag(pkt, BUF_ALLOC_TIMEOUT);
if (!frag) {
goto fail;
}
net_pkt_frag_add(pkt, frag);
net_pkt_set_iface(pkt, iface);
net_pkt_set_family(pkt, AF_INET);
net_pkt_set_ipv4_auto(pkt, true);
return net_arp_prepare(pkt, &cfg->ipv4auto.requested_ip,
&cfg->ipv4auto.current_ip);
fail:
if (pkt) {
net_pkt_unref(pkt);
}
return NULL;
}
static void ipv4_autoconf_send_probe(struct net_if_ipv4_autoconf *ipv4auto)