netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <agartrell@fb.com>, <maheshb@google.com>,
	<tgraf@suug.ch>, <netdev@vger.kernel.org>
Subject: [RFC net-next 6/6] ipvlan: Call ILA in incoming and outgoing receive paths
Date: Wed, 3 Jun 2015 12:58:22 -0700	[thread overview]
Message-ID: <1433361502-3478761-7-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1433361502-3478761-1-git-send-email-tom@herbertland.com>

Hacked IPVLAN to call ILA functions in send and receive paths.

Signed-off-by: Tom Herbert <tom@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

  parent reply	other threads:[~2015-06-03 19:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 19:58 [RFC net-next 0/6] net: Identifier Locator Addressing Tom Herbert
2015-06-03 19:58 ` [RFC net-next 1/6] net: Checksum functions to replace 8 bytes at a time Tom Herbert
2015-06-03 19:58 ` [RFC net-next 2/6] net: Identfier Locator Addressing module Tom Herbert
2015-06-04  8:58   ` Thomas Graf
2015-06-04 10:02   ` Hannes Frederic Sowa
2015-06-03 19:58 ` [RFC net-next 3/6] net: Special routing hook Tom Herbert
2015-06-04  7:40   ` Hannes Frederic Sowa
2015-06-03 19:58 ` [RFC net-next 4/6] net: ILA use special route hook Tom Herbert
2015-06-03 19:58 ` [RFC net-next 5/6] net: ILA iptables target Tom Herbert
2015-06-03 19:58 ` Tom Herbert [this message]
2015-06-04  8:58   ` [RFC net-next 6/6] ipvlan: Call ILA in incoming and outgoing receive paths Thomas Graf
2015-06-04  9:00 ` [RFC net-next 0/6] net: Identifier Locator Addressing Thomas Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433361502-3478761-7-git-send-email-tom@herbertland.com \
    --to=tom@herbertland.com \
    --cc=agartrell@fb.com \
    --cc=davem@davemloft.net \
    --cc=maheshb@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).