diff options
author | Ethan Jackson <ethan@nicira.com> | 2012-07-26 16:29:10 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2012-07-26 17:18:13 -0700 |
commit | 7cb57d10a9b1cd09866b2755e2c5db757e1b1dfc (patch) | |
tree | f0ee660612ab1fb5db98ecd3ee2fa95717e07593 /lib/packets.c | |
parent | 7d48a4cca4c426bbad5872eb9f062b8735adbe8c (diff) |
packets: Remove redundant RARP header.
Rarp packets had their own header definition in the packets
library. This doesn't make sense because they have the same packet
format as arps.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/packets.c')
-rw-r--r-- | lib/packets.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/packets.c b/lib/packets.c index 687a84c5..16f4fe63 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -143,27 +143,27 @@ void compose_rarp(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN]) { struct eth_header *eth; - struct rarp_header *rarp; + struct arp_eth_header *arp; ofpbuf_clear(b); ofpbuf_prealloc_tailroom(b, ETH_HEADER_LEN + VLAN_HEADER_LEN - + RARP_HEADER_LEN); + + ARP_ETH_HEADER_LEN); ofpbuf_reserve(b, VLAN_HEADER_LEN); eth = ofpbuf_put_uninit(b, sizeof *eth); memcpy(eth->eth_dst, eth_addr_broadcast, ETH_ADDR_LEN); memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN); eth->eth_type = htons(ETH_TYPE_RARP); - rarp = ofpbuf_put_uninit(b, sizeof *rarp); - rarp->hw_addr_space = htons(ARP_HTYPE_ETH); - rarp->proto_addr_space = htons(ETH_TYPE_IP); - rarp->hw_addr_length = ETH_ADDR_LEN; - rarp->proto_addr_length = sizeof rarp->src_proto_addr; - rarp->opcode = htons(RARP_REQUEST_REVERSE); - memcpy(rarp->src_hw_addr, eth_src, ETH_ADDR_LEN); - rarp->src_proto_addr = htonl(0); - memcpy(rarp->target_hw_addr, eth_src, ETH_ADDR_LEN); - rarp->target_proto_addr = htonl(0); + arp = ofpbuf_put_uninit(b, sizeof *arp); + arp->ar_hrd = htons(ARP_HRD_ETHERNET); + arp->ar_pro = htons(ARP_PRO_IP); + arp->ar_hln = sizeof arp->ar_sha; + arp->ar_pln = sizeof arp->ar_spa; + arp->ar_op = htons(ARP_OP_RARP); + memcpy(arp->ar_sha, eth_src, ETH_ADDR_LEN); + arp->ar_spa = htonl(0); + memcpy(arp->ar_tha, eth_src, ETH_ADDR_LEN); + arp->ar_tpa = htonl(0); } /* Insert VLAN header according to given TCI. Packet passed must be Ethernet |