Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Anders Franzen <Anders.Franzen@ericsson.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [RFC]: not possible to do policy routing for next hop on tunnels.
Date: Wed, 01 Sep 2010 15:37:48 +0200	[thread overview]
Message-ID: <1283348268.2556.326.camel@edumazet-laptop> (raw)
In-Reply-To: <1283347660.14066.27.camel@seasc7941.dyn.rnd.as.sw.ericsson.se>

Le mercredi 01 septembre 2010 à 15:27 +0200, Anders Franzen a écrit :
> 
> Quick answer!
> 
> It seems do exactly what I want.
> Is there a corresponding 'fwmark inherit' parameter added to the ip
> command somewhere?
> Will this patch get it into the kernel?
> 
> If you need testing I will do that.

Following iproute2 patch (against current git) should be applied.

I suggest we continue by private mails to polish patches ;)

Thanks

diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index acb9ad6..bf22b03 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -16,6 +16,8 @@
 #define IP6_TNL_F_MIP6_DEV 0x8
 /* copy DSCP from the outer packet */
 #define IP6_TNL_F_RCV_DSCP_COPY 0x10
+/* copy fwmark from inner packet */
+#define IP6_TNL_F_USE_ORIG_FWMARK 0x20
 
 struct ip6_tnl_parm {
 	char name[IFNAMSIZ];	/* name of tunnel device */
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index 203e4a3..2c406e3 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -51,7 +51,7 @@ static void usage(void)
 	fprintf(stderr, "          [ remote ADDR local ADDR ] [ dev PHYS_DEV ]\n");
 	fprintf(stderr, "          [ encaplimit ELIM ]\n");
 	fprintf(stderr ,"          [ hoplimit TTL ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
-	fprintf(stderr, "          [ dscp inherit ]\n");
+	fprintf(stderr, "          [ dscp inherit ] [ fwmark inherit] \n");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "Where: NAME      := STRING\n");
 	fprintf(stderr, "       ADDR      := IPV6_ADDRESS\n");
@@ -103,6 +103,10 @@ static void print_tunnel(struct ip6_tnl_parm *p)
 
 	if (p->flags & IP6_TNL_F_RCV_DSCP_COPY)
 		printf(" dscp inherit");
+
+	if (p->flags & IP6_TNL_F_USE_ORIG_FWMARK)
+		printf(" fwmark inherit");
+
 }
 
 static int parse_args(int argc, char **argv, struct ip6_tnl_parm *p)
@@ -197,6 +201,11 @@ static int parse_args(int argc, char **argv, struct ip6_tnl_parm *p)
 			if (strcmp(*argv, "inherit") != 0)
 				invarg("not inherit", *argv);
 			p->flags |= IP6_TNL_F_RCV_DSCP_COPY;
+		} else if (strcmp(*argv, "fwmark") == 0) {
+			NEXT_ARG();
+			if (strcmp(*argv, "inherit") != 0)
+				invarg("not inherit", *argv);
+			p->flags |= IP6_TNL_F_USE_ORIG_FWMARK;
 		} else {
 			if (strcmp(*argv, "name") == 0) {
 				NEXT_ARG();



      reply	other threads:[~2010-09-01 13:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01 12:21 [RFC]: not possible to do policy routing for next hop on tunnels Anders Franzen
2010-09-01 12:49 ` Eric Dumazet
2010-09-01 13:27   ` Anders Franzen
2010-09-01 13:37     ` Eric Dumazet [this message]

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=1283348268.2556.326.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=Anders.Franzen@ericsson.com \
    --cc=netdev@vger.kernel.org \
    /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