The bareudp device could be used along with OVS or flower filter in TC.
The OVS or TC flower layer must set the tunnel information in SKB dst field before
sending packet buffer to the bareudp device for transmission. On reception the
-bareudp device extracts and stores the tunnel information in SKB dst field before
-passing the packet buffer to the network stack.
+bareudp device decapsulates the udp header and passes the inner packet to the
+network stack. If RX_COLLECT_METADATA flag is enabled in the device the tunnel
+information will be stored in the SKB dst field before the packet buffer is
+passed to the network stack.
__be16 port;
u16 sport_min;
bool multi_proto_mode;
+ bool rx_collect_metadata;
struct socket __rcu *sock;
struct list_head next; /* bareudp node on namespace list */
struct gro_cells gro_cells;
bareudp->dev->stats.rx_dropped++;
goto drop;
}
-
- tun_dst = udp_tun_rx_dst(skb, family, TUNNEL_KEY, 0, 0);
- if (!tun_dst) {
- bareudp->dev->stats.rx_dropped++;
- goto drop;
+ if (bareudp->rx_collect_metadata) {
+ tun_dst = udp_tun_rx_dst(skb, family, TUNNEL_KEY, 0, 0);
+ if (!tun_dst) {
+ bareudp->dev->stats.rx_dropped++;
+ goto drop;
+ }
+ skb_dst_set(skb, &tun_dst->dst);
}
- skb_dst_set(skb, &tun_dst->dst);
skb->dev = bareudp->dev;
oiph = skb_network_header(skb);
skb_reset_network_header(skb);
if (data[IFLA_BAREUDP_MULTIPROTO_MODE])
conf->multi_proto_mode = true;
+ if (data[IFLA_BAREUDP_RX_COLLECT_METADATA])
+ conf->rx_collect_metadata = true;
+
return 0;
}
bareudp->ethertype = conf->ethertype;
bareudp->sport_min = conf->sport_min;
bareudp->multi_proto_mode = conf->multi_proto_mode;
+ bareudp->rx_collect_metadata = conf->rx_collect_metadata;
+
err = register_netdevice(dev);
if (err)
return err;
nla_total_size(sizeof(__be16)) + /* IFLA_BAREUDP_ETHERTYPE */
nla_total_size(sizeof(__u16)) + /* IFLA_BAREUDP_SRCPORT_MIN */
nla_total_size(0) + /* IFLA_BAREUDP_MULTIPROTO_MODE */
+ nla_total_size(0) + /* IFLA_BAREUDP_RX_COLLECT_METADATA */
0;
}
if (bareudp->multi_proto_mode &&
nla_put_flag(skb, IFLA_BAREUDP_MULTIPROTO_MODE))
goto nla_put_failure;
+ if (bareudp->rx_collect_metadata &&
+ nla_put_flag(skb, IFLA_BAREUDP_RX_COLLECT_METADATA))
+ goto nla_put_failure;
return 0;