Hacked IPVLAN to call ILA functions in send and receive paths. Signed-off-by: Tom Herbert <t...@herbertland.com> --- drivers/net/ipvlan/ipvlan.h | 1 + drivers/net/ipvlan/ipvlan_core.c | 27 ++++++++++++++++++--------- drivers/net/ipvlan/ipvlan_main.c | 4 ++++ 3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h index 953a974..3b85260 100644 --- a/drivers/net/ipvlan/ipvlan.h +++ b/drivers/net/ipvlan/ipvlan.h @@ -28,6 +28,7 @@ #include <net/rtnetlink.h> #include <net/route.h> #include <net/addrconf.h> +#include <net/ila.h> #define IPVLAN_DRV "ipvlan" #define IPV_DRV_VER "0.1" diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 8afbeda..7e71907 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -9,6 +9,8 @@ #include "ipvlan.h" +extern bool query_ila; + static u32 ipvlan_jhash_secret __read_mostly; void ipvlan_init_secret(void) @@ -385,15 +387,18 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) struct net_device *dev = skb->dev; struct dst_entry *dst; int err, ret = NET_XMIT_DROP; - struct flowi6 fl6 = { - .flowi6_iif = skb->dev->ifindex, - .daddr = ip6h->daddr, - .saddr = ip6h->saddr, - .flowi6_flags = FLOWI_FLAG_ANYSRC, - .flowlabel = ip6_flowinfo(ip6h), - .flowi6_mark = skb->mark, - .flowi6_proto = ip6h->nexthdr, - }; + struct flowi6 fl6; + + if (query_ila && ila_xlat_outgoing(skb) < 0) + goto err; + + fl6.flowi6_iif = skb->dev->ifindex; + fl6.daddr = ip6h->daddr; + fl6.saddr = ip6h->saddr; + fl6.flowi6_flags = FLOWI_FLAG_ANYSRC; + fl6.flowlabel = ip6_flowinfo(ip6h); + fl6.flowi6_mark = skb->mark; + fl6.flowi6_proto = ip6h->nexthdr; dst = ip6_route_output(dev_net(dev), NULL, &fl6); if (dst->error) { @@ -401,6 +406,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) dst_release(dst); goto err; } + skb_dst_drop(skb); skb_dst_set(skb, dst); err = ip6_local_out(skb); @@ -583,6 +589,9 @@ static rx_handler_result_t ipvlan_handle_mode_l3(struct sk_buff **pskb, struct sk_buff *skb = *pskb; rx_handler_result_t ret = RX_HANDLER_PASS; + if (query_ila && ila_xlat_incoming(skb) < 0) + goto out; + lyr3h = ipvlan_get_L3_hdr(skb, &addr_type); if (!lyr3h) goto out; diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 1acc283..e029fad 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -9,6 +9,10 @@ #include "ipvlan.h" +bool query_ila = false; +module_param(query_ila, bool, 0644); +MODULE_PARM_DESC(query_ila, "Query ILA in incoming and outgoing paths"); + void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev) { ipvlan->dev->mtu = dev->mtu - ipvlan->mtu_adj; -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html