On 10/17/2018 6:01 AM, Yousong Zhou wrote:
I tried to use ip-over-gre with openvswitch 2.8.4, but no "ip proto
47" traffic can be seen with tcpdump.  Later I added a WARN_ON_ONCE(1)
line just before the "goto drop" statement in ovs_vport_send() and it
was triggered right away thus pinpointed the problem.

It looks to me openvswitch linux kernel datapath always create
ARPHRD_IPGRE device and never set dev->type to ARPHRD_NONE.  Please
correct me if this is not the case.  The ovs-vswitchd.conf.db doc says
setting packet_type=legacy_l3 should work.  I am trying to figure
what's the missing piece.

Openvswitch 2.8.4 depends on the built-in gre kernel module and it is true that
module will always set the device type to ARPHRD_IPGRE upon initial creation
but if the tunnel is set to a metadata type tunnel then the device type should
be reset to ARPHRD_NONE.


From ../net/ipv4/ip_gre.c:L1037
    if (data[IFLA_GRE_COLLECT_METADATA]) {
        struct ip_tunnel *t = netdev_priv(dev);

        t->collect_md = true;
        if (dev->type == ARPHRD_IPGRE)
            dev->type = ARPHRD_NONE;
    }

https://elixir.bootlin.com/linux/v4.6/source/net/ipv4/ip_gre.c#L1037

Perhaps that code is not being hit?

- Greg


--- vport.c.orig 2018-10-17 12:51:22.484824861 +0000
+++ vport.c 2018-10-17 12:51:24.873798775 +0000
@@ -541,8 +541,10 @@ void ovs_vport_send(struct vport *vport,
   }
   break;
   case ARPHRD_ETHER:
- if (mac_proto != MAC_PROTO_ETHERNET)
+ if (mac_proto != MAC_PROTO_ETHERNET) {
+ WARN_ON_ONCE(1);
   goto drop;
+ }
   break;
   default:
   goto drop;

Below is a short snippet of how I added the port and flow in case it may help.

ovs-vsctl add-port br0 tun0 -- set interface tun0 type=gre
options:remote_ip=flow options:key=flow options:packet_type=legacy_l2
ofport_request=2

ovs-ofctl add-flow br0
'priority=100,in_port=veth1cus,ip,nw_dst=10.8.1.0/24,actions=set_tunnel:128,set_field:10.0.2.196->tun_dst,output:tun0'

[root@h0g0 ~]# ovs-dpctl show
system@ovs-system:
         lookups: hit:19553 missed:3 lost:1
         flows: 1
         masks: hit:19555 total:1 hit/pkt:1.00
         port 0: ovs-system (internal)
         port 1: gre_sys (gre: packet_type=ptap)
         port 2: br0 (internal)
         port 3: veth1cus

[root@h0g0 ~]# ovs-dpctl dump-flows
recirc_id(0),in_port(3),eth(),eth_type(0x0800),ipv4(dst=10.8.1.0/255.255.255.0,tos=0/0x3,frag=no),
packets:19569, bytes:1917762, used:0.043s,
actions:set(tunnel(tun_id=0x80,dst=10.0.2.196,ttl=64,flags(df|key))),pop_eth,1

Regards,
                 yousong
_______________________________________________
discuss mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

_______________________________________________
discuss mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to