diff mbox

[RFC] : not possible to do policy routing for next hop on tunnels.

Message ID 1283348268.2556.326.camel@edumazet-laptop
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Sept. 1, 2010, 1:37 p.m. UTC
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



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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();