summaryrefslogtreecommitdiffstats
path: root/src/net/arp.c
diff options
context:
space:
mode:
authorMichael Brown2006-04-29 19:17:43 +0200
committerMichael Brown2006-04-29 19:17:43 +0200
commitbac97eb979e5048b065f01c6b5e7d63ffc3abf48 (patch)
tree23397f1f4cd4f4f68d50aae3b294db94acb06700 /src/net/arp.c
parentAdded basic code for implementing co-operative multitasking. (diff)
downloadipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.tar.gz
ipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.tar.xz
ipxe-bac97eb979e5048b065f01c6b5e7d63ffc3abf48.zip
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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net/arp.c b/src/net/arp.c
index 3720acfc..af7d6e12 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,
};