diff options
author | Michael Brown <mcb30@etherboot.org> | 2006-04-29 17:17:43 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2006-04-29 17:17:43 +0000 |
commit | bac97eb979e5048b065f01c6b5e7d63ffc3abf48 (patch) | |
tree | 23397f1f4cd4f4f68d50aae3b294db94acb06700 /src/net/arp.c | |
parent | 23c494d14efafdd1dd06cec53665ddfd1c20fa34 (diff) | |
download | ipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.zip ipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.tar.gz ipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.tar.bz2 |
Change semantics of network API so that packet-absorbing calls *always*
take ownership of the packet, rather than doing so only if they return
success. This breaks semantic compatibility with Linux's
hard_start_xmit() method, but means that we don't have to worry so much
about error cases.
Split mechanism of processing received packets (net_rx_process()) out
from policy (net_step()), preparatory to putting net_step() in a separate
object.
Diffstat (limited to 'src/net/arp.c')
-rw-r--r-- | src/net/arp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net/arp.c b/src/net/arp.c index 3720acf..af7d6e1 100644 --- a/src/net/arp.c +++ b/src/net/arp.c @@ -154,10 +154,8 @@ int arp_resolve ( struct net_device *netdev, const struct net_header *nethdr, nethdr->dest_net_addr, net_protocol->net_addr_len ); /* Transmit ARP request */ - if ( ( rc = net_transmit_via ( pkb, netdev ) ) != 0 ) { - free_pkb ( pkb ); + if ( ( rc = net_transmit_via ( pkb, netdev ) ) != 0 ) return rc; - } return -ENOENT; } @@ -230,7 +228,7 @@ static int arp_rx ( struct pk_buff *pkb ) { if ( arphdr->ar_op != htons ( ARPOP_REQUEST ) ) goto done; - /* Change request to a reply, and send it */ + /* Change request to a reply */ DBG ( "ARP reply: %s %s => %s %s\n", net_protocol->name, net_protocol->ntoa ( arp_target_pa ( arphdr ) ), ll_protocol->name, ll_protocol->ntoa ( netdev->ll_addr ) ); @@ -238,8 +236,10 @@ static int arp_rx ( struct pk_buff *pkb ) { memswap ( arp_sender_ha ( arphdr ), arp_target_ha ( arphdr ), arphdr->ar_hln + arphdr->ar_pln ); memcpy ( arp_target_ha ( arphdr ), netdev->ll_addr, arphdr->ar_hln ); - if ( net_transmit_via ( pkb, netdev ) == 0 ) - pkb = NULL; + + /* Send reply */ + net_transmit_via ( pkb, netdev ); + pkb = NULL; done: free_pkb ( pkb ); @@ -286,7 +286,7 @@ arp_ntoa ( const void *net_addr __attribute__ (( unused )) ) { struct net_protocol arp_protocol = { .name = "ARP", .net_proto = htons ( ETH_P_ARP ), - .rx = arp_rx, + .rx_process = arp_rx, .route = arp_route, .ntoa = arp_ntoa, }; |