From: Ethan Jackson Date: Thu, 26 Jul 2012 23:29:10 +0000 (-0700) Subject: packets: Remove redundant RARP header. X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~166 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7cb57d10a9b1cd09866b2755e2c5db757e1b1dfc;p=sliver-openvswitch.git 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 --- diff --git a/lib/packets.c b/lib/packets.c index 687a84c5d..16f4fe63a 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 diff --git a/lib/packets.h b/lib/packets.h index ad5631db3..e5be1cb99 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -229,25 +229,6 @@ struct llc_snap_header { } __attribute__((packed)); BUILD_ASSERT_DECL(LLC_SNAP_HEADER_LEN == sizeof(struct llc_snap_header)); -#define ARP_HTYPE_ETH 0x0001 -#define RARP_REQUEST_REVERSE 0x0003 - -#define RARP_HEADER_LEN 28 -/* RARP header only for Ethernet-IP. */ -struct rarp_header { - ovs_be16 hw_addr_space; /* ARP_HTYPE_ETH. */ - ovs_be16 proto_addr_space; /* ETH_TYPE_IP. */ - uint8_t hw_addr_length; /* ETH_ADDR_LEN. */ - uint8_t proto_addr_length; /* IPV4_ADDR_LEN. */ - ovs_be16 opcode; /* RARP_REQUEST_REVERSE. */ - uint8_t src_hw_addr[ETH_ADDR_LEN]; - ovs_be32 src_proto_addr; - uint8_t target_hw_addr[ETH_ADDR_LEN]; - ovs_be32 target_proto_addr; -} __attribute__((packed)); -BUILD_ASSERT_DECL(RARP_HEADER_LEN == sizeof(struct rarp_header)); - - #define VLAN_VID_MASK 0x0fff #define VLAN_VID_SHIFT 0 @@ -427,6 +408,7 @@ BUILD_ASSERT_DECL(TCP_HEADER_LEN == sizeof(struct tcp_header)); #define ARP_PRO_IP 0x0800 #define ARP_OP_REQUEST 1 #define ARP_OP_REPLY 2 +#define ARP_OP_RARP 3 #define ARP_ETH_HEADER_LEN 28 struct arp_eth_header {