Hi,

I’m experimenting with attaching metadata_dst to skb in the gtp recv path. The 
goal is to let ovs to meter the gtp traffic. However, I encountered the 
following error in ovs_flow_cmd_new
:
[ 411.462443] openvswitch: netlink: Unexpected mask (mask=110058, 
allowed=41980cc)
Seems the OVS_KEY_ATTR_ETHERNET bit is not allowed.

Why does the error happen?

My setup is as following,

libgtpnl:
modprobe gtp
./gtp-link add gtp0
./gtp-tunnel add gtp0 v1 999 123 1.1.1.1 192.168.60.143

ovs dev branch:
ovs-vsctl add-br br0
ifconfig br0 1.1.1.122/24 up
ovs-vsctl add-port br0 gtp0


Linux 4.9 drivers/net/gtp.c:
@@ -270,12 +274,33 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, 
struct sk_buff *skb,
                goto out_rcu;
        }
        rcu_read_unlock();
+*/
+        if (ip_tunnel_collect_metadata() || true) { // always collect metadata
+                __be16 flags;
+               struct metadata_dst *tun_dst;
+
+                flags = TUNNEL_KEY;
+
+                tun_dst = udp_tun_rx_dst(skb, gtp->sock1u->sk->sk_family, 
flags,
+                                         ntohl(gtp1->tid), 0);
+                if (!tun_dst)
+                        goto drop;
+
+               netdev_info(gtp->dev, "Attaching tun_dst to skb...");
+               skb_dst_set(skb, (struct dst_entry *)tun_dst);
+        } else {
+               netdev_err(gtp->dev, "Not collecting metadata");
+        }


Thanks
-Jiannan
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to