mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 14:55:18 +00:00
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>
This commit is contained in:
@@ -143,27 +143,27 @@ void
|
|||||||
compose_rarp(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN])
|
compose_rarp(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN])
|
||||||
{
|
{
|
||||||
struct eth_header *eth;
|
struct eth_header *eth;
|
||||||
struct rarp_header *rarp;
|
struct arp_eth_header *arp;
|
||||||
|
|
||||||
ofpbuf_clear(b);
|
ofpbuf_clear(b);
|
||||||
ofpbuf_prealloc_tailroom(b, ETH_HEADER_LEN + VLAN_HEADER_LEN
|
ofpbuf_prealloc_tailroom(b, ETH_HEADER_LEN + VLAN_HEADER_LEN
|
||||||
+ RARP_HEADER_LEN);
|
+ ARP_ETH_HEADER_LEN);
|
||||||
ofpbuf_reserve(b, VLAN_HEADER_LEN);
|
ofpbuf_reserve(b, VLAN_HEADER_LEN);
|
||||||
eth = ofpbuf_put_uninit(b, sizeof *eth);
|
eth = ofpbuf_put_uninit(b, sizeof *eth);
|
||||||
memcpy(eth->eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
|
memcpy(eth->eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
|
||||||
memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN);
|
memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN);
|
||||||
eth->eth_type = htons(ETH_TYPE_RARP);
|
eth->eth_type = htons(ETH_TYPE_RARP);
|
||||||
|
|
||||||
rarp = ofpbuf_put_uninit(b, sizeof *rarp);
|
arp = ofpbuf_put_uninit(b, sizeof *arp);
|
||||||
rarp->hw_addr_space = htons(ARP_HTYPE_ETH);
|
arp->ar_hrd = htons(ARP_HRD_ETHERNET);
|
||||||
rarp->proto_addr_space = htons(ETH_TYPE_IP);
|
arp->ar_pro = htons(ARP_PRO_IP);
|
||||||
rarp->hw_addr_length = ETH_ADDR_LEN;
|
arp->ar_hln = sizeof arp->ar_sha;
|
||||||
rarp->proto_addr_length = sizeof rarp->src_proto_addr;
|
arp->ar_pln = sizeof arp->ar_spa;
|
||||||
rarp->opcode = htons(RARP_REQUEST_REVERSE);
|
arp->ar_op = htons(ARP_OP_RARP);
|
||||||
memcpy(rarp->src_hw_addr, eth_src, ETH_ADDR_LEN);
|
memcpy(arp->ar_sha, eth_src, ETH_ADDR_LEN);
|
||||||
rarp->src_proto_addr = htonl(0);
|
arp->ar_spa = htonl(0);
|
||||||
memcpy(rarp->target_hw_addr, eth_src, ETH_ADDR_LEN);
|
memcpy(arp->ar_tha, eth_src, ETH_ADDR_LEN);
|
||||||
rarp->target_proto_addr = htonl(0);
|
arp->ar_tpa = htonl(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert VLAN header according to given TCI. Packet passed must be Ethernet
|
/* Insert VLAN header according to given TCI. Packet passed must be Ethernet
|
||||||
|
@@ -229,25 +229,6 @@ struct llc_snap_header {
|
|||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
BUILD_ASSERT_DECL(LLC_SNAP_HEADER_LEN == sizeof(struct llc_snap_header));
|
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_MASK 0x0fff
|
||||||
#define VLAN_VID_SHIFT 0
|
#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_PRO_IP 0x0800
|
||||||
#define ARP_OP_REQUEST 1
|
#define ARP_OP_REQUEST 1
|
||||||
#define ARP_OP_REPLY 2
|
#define ARP_OP_REPLY 2
|
||||||
|
#define ARP_OP_RARP 3
|
||||||
|
|
||||||
#define ARP_ETH_HEADER_LEN 28
|
#define ARP_ETH_HEADER_LEN 28
|
||||||
struct arp_eth_header {
|
struct arp_eth_header {
|
||||||
|
Reference in New Issue
Block a user