diff options
author | Jiri Benc <jbenc@redhat.com> | 2016-11-10 16:28:21 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-13 00:51:02 -0500 |
commit | 5108bbaddc37c1c8583f0cf2562d7d3463cd12cb (patch) | |
tree | 6f3b06a52f5ef5b64c66eefb94f51c76dad00d79 /net/openvswitch/vport.c | |
parent | 1560a074df6297e76278e459ca3eb9ff83a6f878 (diff) | |
download | linux-5108bbaddc37c1c8583f0cf2562d7d3463cd12cb.tar.gz linux-5108bbaddc37c1c8583f0cf2562d7d3463cd12cb.tar.bz2 linux-5108bbaddc37c1c8583f0cf2562d7d3463cd12cb.zip |
openvswitch: add processing of L3 packets
Support receiving, extracting flow key and sending of L3 packets (packets
without an Ethernet header).
Note that even after this patch, non-Ethernet interfaces are still not
allowed to be added to bridges. Similarly, netlink interface for sending and
receiving L3 packets to/from user space is not in place yet.
Based on previous versions by Lorand Jakab and Simon Horman.
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/vport.c')
-rw-r--r-- | net/openvswitch/vport.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 898ed377b5cc..b6c8524032a0 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -485,6 +485,25 @@ void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto) { int mtu = vport->dev->mtu; + switch (vport->dev->type) { + case ARPHRD_NONE: + if (mac_proto == MAC_PROTO_ETHERNET) { + skb_reset_network_header(skb); + skb_reset_mac_len(skb); + skb->protocol = htons(ETH_P_TEB); + } else if (mac_proto != MAC_PROTO_NONE) { + WARN_ON_ONCE(1); + goto drop; + } + break; + case ARPHRD_ETHER: + if (mac_proto != MAC_PROTO_ETHERNET) + goto drop; + break; + default: + goto drop; + } + if (unlikely(packet_length(skb, vport->dev) > mtu && !skb_is_gso(skb))) { net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n", |