diff options
author | Ben Pfaff <blp@nicira.com> | 2013-10-09 17:37:30 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-10-09 17:37:30 -0700 |
commit | f6c8a6b163af343c66aea54953553d84863835f7 (patch) | |
tree | cc0811df0eeadee9c2d6bf5407005b1b199b03d0 /lib/odp-execute.c | |
parent | 7fd91025664b6ecbdca51427a2905a4f35ee3a16 (diff) |
Add software switch support for modifying ARP headers in OpenFlow.
This support is added through the userspace slow path, because we don't
judge that this is important enough to require permanent support in the
Linux kernel ABI.
Bug #19259.
CC: Teemu Koponen <koponen@nicira.com>
CC: Pankaj Thakkar <thakkar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/odp-execute.c')
-rw-r--r-- | lib/odp-execute.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/odp-execute.c b/lib/odp-execute.c index 3914c3b7..185cf319 100644 --- a/lib/odp-execute.c +++ b/lib/odp-execute.c @@ -25,6 +25,7 @@ #include "ofpbuf.h" #include "odp-util.h" #include "packets.h" +#include "unaligned.h" #include "util.h" static void @@ -46,6 +47,18 @@ odp_set_tunnel_action(const struct nlattr *a, struct flow_tnl *tun_key) } static void +set_arp(struct ofpbuf *packet, const struct ovs_key_arp *arp_key) +{ + struct arp_eth_header *arp = packet->l3; + + arp->ar_op = arp_key->arp_op; + memcpy(arp->ar_sha, arp_key->arp_sha, ETH_ADDR_LEN); + put_16aligned_be32(&arp->ar_spa, arp_key->arp_sip); + memcpy(arp->ar_tha, arp_key->arp_tha, ETH_ADDR_LEN); + put_16aligned_be32(&arp->ar_tpa, arp_key->arp_tip); +} + +static void odp_execute_set_action(struct ofpbuf *packet, const struct nlattr *a, struct flow *flow) { @@ -106,6 +119,10 @@ odp_execute_set_action(struct ofpbuf *packet, const struct nlattr *a, set_mpls_lse(packet, nl_attr_get_be32(a)); break; + case OVS_KEY_ATTR_ARP: + set_arp(packet, nl_attr_get_unspec(a, sizeof(struct ovs_key_arp))); + break; + case OVS_KEY_ATTR_UNSPEC: case OVS_KEY_ATTR_ENCAP: case OVS_KEY_ATTR_ETHERTYPE: @@ -113,7 +130,6 @@ odp_execute_set_action(struct ofpbuf *packet, const struct nlattr *a, case OVS_KEY_ATTR_VLAN: case OVS_KEY_ATTR_ICMP: case OVS_KEY_ATTR_ICMPV6: - case OVS_KEY_ATTR_ARP: case OVS_KEY_ATTR_ND: case __OVS_KEY_ATTR_MAX: default: |