netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 net-next 0/2] Add DF configuration for VxLAN and GENEVE link types
@ 2018-11-06 21:39 Stefano Brivio
  2018-11-06 21:39 ` [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration Stefano Brivio
  2018-11-06 21:39 ` [PATCH iproute2 net-next 2/2] iplink_geneve: " Stefano Brivio
  0 siblings, 2 replies; 5+ messages in thread
From: Stefano Brivio @ 2018-11-06 21:39 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev

This series adds configuration of the DF bit in outgoing IPv4 packets for
VxLAN and GENEVE link types.

I also included uapi/linux/if_link.h changes for convenience, please let
me know if I should repost without them.

Stefano Brivio (2):
  iplink_vxlan: Add DF configuration
  iplink_geneve: Add DF configuration

 include/uapi/linux/if_link.h | 18 ++++++++++++++++++
 ip/iplink_geneve.c           | 29 +++++++++++++++++++++++++++++
 ip/iplink_vxlan.c            | 29 +++++++++++++++++++++++++++++
 man/man8/ip-link.8.in        | 28 ++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration
  2018-11-06 21:39 [PATCH iproute2 net-next 0/2] Add DF configuration for VxLAN and GENEVE link types Stefano Brivio
@ 2018-11-06 21:39 ` Stefano Brivio
  2018-11-07 20:03   ` David Ahern
  2018-11-06 21:39 ` [PATCH iproute2 net-next 2/2] iplink_geneve: " Stefano Brivio
  1 sibling, 1 reply; 5+ messages in thread
From: Stefano Brivio @ 2018-11-06 21:39 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev

Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 include/uapi/linux/if_link.h |  9 +++++++++
 ip/iplink_vxlan.c            | 29 +++++++++++++++++++++++++++++
 man/man8/ip-link.8.in        | 14 ++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 9c254603ebda..4caf683ce546 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -530,6 +530,7 @@ enum {
 	IFLA_VXLAN_LABEL,
 	IFLA_VXLAN_GPE,
 	IFLA_VXLAN_TTL_INHERIT,
+	IFLA_VXLAN_DF,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
@@ -539,6 +540,14 @@ struct ifla_vxlan_port_range {
 	__be16	high;
 };
 
+enum ifla_vxlan_df {
+	VXLAN_DF_UNSET = 0,
+	VXLAN_DF_SET,
+	VXLAN_DF_INHERIT,
+	__VXLAN_DF_END,
+	VXLAN_DF_MAX = __VXLAN_DF_END - 1,
+};
+
 /* GENEVE section */
 enum {
 	IFLA_GENEVE_UNSPEC,
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 7fc0e2b4eb06..86afbe1334f0 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -31,6 +31,7 @@ static void print_explain(FILE *f)
 		"                 [ local ADDR ]\n"
 		"                 [ ttl TTL ]\n"
 		"                 [ tos TOS ]\n"
+		"                 [ df DF ]\n"
 		"                 [ flowlabel LABEL ]\n"
 		"                 [ dev PHYS_DEV ]\n"
 		"                 [ dstport PORT ]\n"
@@ -52,6 +53,7 @@ static void print_explain(FILE *f)
 		"       ADDR  := { IP_ADDRESS | any }\n"
 		"       TOS   := { NUMBER | inherit }\n"
 		"       TTL   := { 1..255 | auto | inherit }\n"
+		"       DF    := { unset | set | inherit }\n"
 		"       LABEL := 0-1048575\n"
 	);
 }
@@ -170,6 +172,22 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 			} else
 				tos = 1;
 			addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
+		} else if (!matches(*argv, "df")) {
+			enum ifla_vxlan_df df;
+
+			NEXT_ARG();
+			check_duparg(&attrs, IFLA_VXLAN_DF, "df", *argv);
+			if (strcmp(*argv, "unset") == 0)
+				df = VXLAN_DF_UNSET;
+			else if (strcmp(*argv, "set") == 0)
+				df = VXLAN_DF_SET;
+			else if (strcmp(*argv, "inherit") == 0)
+				df = VXLAN_DF_INHERIT;
+			else
+				invarg("DF must be 'unset', 'set' or 'inherit'",
+				       *argv);
+
+			addattr8(n, 1024, IFLA_VXLAN_DF, df);
 		} else if (!matches(*argv, "label") ||
 			   !matches(*argv, "flowlabel")) {
 			__u32 uval;
@@ -538,6 +556,17 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			print_string(PRINT_FP, NULL, "ttl %s ", "auto");
 	}
 
+	if (tb[IFLA_VXLAN_DF]) {
+		enum ifla_vxlan_df df = rta_getattr_u8(tb[IFLA_VXLAN_DF]);
+
+		if (df == VXLAN_DF_UNSET)
+			print_string(PRINT_JSON, "df", "df %s ", "unset");
+		else if (df == VXLAN_DF_SET)
+			print_string(PRINT_ANY, "df", "df %s ", "set");
+		else if (df == VXLAN_DF_INHERIT)
+			print_string(PRINT_ANY, "df", "df %s ", "inherit");
+	}
+
 	if (tb[IFLA_VXLAN_LABEL]) {
 		__u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
 
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 5132f514b279..1b899dd06b92 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -496,6 +496,8 @@ the following additional arguments are supported:
 ] [
 .BI tos " TOS "
 ] [
+.BI df " DF "
+] [
 .BI flowlabel " FLOWLABEL "
 ] [
 .BI dstport " PORT "
@@ -565,6 +567,18 @@ parameter.
 .BI tos " TOS"
 - specifies the TOS value to use in outgoing packets.
 
+.sp
+.BI df " DF"
+- specifies the usage of the DF bit in outgoing packets with IPv4 headers.
+The value
+.B inherit
+causes the bit to be copied from the original IP header. The values
+.B unset
+and
+.B set
+cause the bit to be always unset or always set, respectively. By default, the
+bit is not set.
+
 .sp
 .BI flowlabel " FLOWLABEL"
 - specifies the flow label to use in outgoing packets.
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH iproute2 net-next 2/2] iplink_geneve: Add DF configuration
  2018-11-06 21:39 [PATCH iproute2 net-next 0/2] Add DF configuration for VxLAN and GENEVE link types Stefano Brivio
  2018-11-06 21:39 ` [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration Stefano Brivio
@ 2018-11-06 21:39 ` Stefano Brivio
  1 sibling, 0 replies; 5+ messages in thread
From: Stefano Brivio @ 2018-11-06 21:39 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev

Allow to set the DF bit behaviour for outgoing IPv4 packets: it can be
always on, inherited from the inner header, or, by default, always off,
which is the current behaviour.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 include/uapi/linux/if_link.h |  9 +++++++++
 ip/iplink_geneve.c           | 29 +++++++++++++++++++++++++++++
 man/man8/ip-link.8.in        | 14 ++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 4caf683ce546..183ca7527178 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -563,10 +563,19 @@ enum {
 	IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
 	IFLA_GENEVE_LABEL,
 	IFLA_GENEVE_TTL_INHERIT,
+	IFLA_GENEVE_DF,
 	__IFLA_GENEVE_MAX
 };
 #define IFLA_GENEVE_MAX	(__IFLA_GENEVE_MAX - 1)
 
+enum ifla_geneve_df {
+	GENEVE_DF_UNSET = 0,
+	GENEVE_DF_SET,
+	GENEVE_DF_INHERIT,
+	__GENEVE_DF_END,
+	GENEVE_DF_MAX = __GENEVE_DF_END - 1,
+};
+
 /* PPP section */
 enum {
 	IFLA_PPP_UNSPEC,
diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
index c417842b2a5b..1872b74c5d70 100644
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -24,6 +24,7 @@ static void print_explain(FILE *f)
 		"                  remote ADDR\n"
 		"                  [ ttl TTL ]\n"
 		"                  [ tos TOS ]\n"
+		"                  [ df DF ]\n"
 		"                  [ flowlabel LABEL ]\n"
 		"                  [ dstport PORT ]\n"
 		"                  [ [no]external ]\n"
@@ -35,6 +36,7 @@ static void print_explain(FILE *f)
 		"       ADDR  := IP_ADDRESS\n"
 		"       TOS   := { NUMBER | inherit }\n"
 		"       TTL   := { 1..255 | auto | inherit }\n"
+		"       DF    := { unset | set | inherit }\n"
 		"       LABEL := 0-1048575\n"
 	);
 }
@@ -115,6 +117,22 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
 				tos = uval;
 			} else
 				tos = 1;
+		} else if (!matches(*argv, "df")) {
+			enum ifla_geneve_df df;
+
+			NEXT_ARG();
+			check_duparg(&attrs, IFLA_GENEVE_DF, "df", *argv);
+			if (strcmp(*argv, "unset") == 0)
+				df = GENEVE_DF_UNSET;
+			else if (strcmp(*argv, "set") == 0)
+				df = GENEVE_DF_SET;
+			else if (strcmp(*argv, "inherit") == 0)
+				df = GENEVE_DF_INHERIT;
+			else
+				invarg("DF must be 'unset', 'set' or 'inherit'",
+				       *argv);
+
+			addattr8(n, 1024, IFLA_GENEVE_DF, df);
 		} else if (!matches(*argv, "label") ||
 			   !matches(*argv, "flowlabel")) {
 			__u32 uval;
@@ -287,6 +305,17 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			print_string(PRINT_FP, NULL, "tos %s ", "inherit");
 	}
 
+	if (tb[IFLA_GENEVE_DF]) {
+		enum ifla_geneve_df df = rta_getattr_u8(tb[IFLA_GENEVE_DF]);
+
+		if (df == GENEVE_DF_UNSET)
+			print_string(PRINT_JSON, "df", "df %s ", "unset");
+		else if (df == GENEVE_DF_SET)
+			print_string(PRINT_ANY, "df", "df %s ", "set");
+		else if (df == GENEVE_DF_INHERIT)
+			print_string(PRINT_ANY, "df", "df %s ", "inherit");
+	}
+
 	if (tb[IFLA_GENEVE_LABEL]) {
 		__u32 label = rta_getattr_u32(tb[IFLA_GENEVE_LABEL]);
 
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 1b899dd06b92..568e0aa02579 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1180,6 +1180,8 @@ the following additional arguments are supported:
 ] [
 .BI tos " TOS "
 ] [
+.BI df " DF "
+] [
 .BI flowlabel " FLOWLABEL "
 ] [
 .BI dstport " PORT"
@@ -1212,6 +1214,18 @@ ttl. Default option is "0".
 .BI tos " TOS"
 - specifies the TOS value to use in outgoing packets.
 
+.sp
+.BI df " DF"
+- specifies the usage of the DF bit in outgoing packets with IPv4 headers.
+The value
+.B inherit
+causes the bit to be copied from the original IP header. The values
+.B unset
+and
+.B set
+cause the bit to be always unset or always set, respectively. By default, the
+bit is not set.
+
 .sp
 .BI flowlabel " FLOWLABEL"
 - specifies the flow label to use in outgoing packets.
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration
  2018-11-06 21:39 ` [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration Stefano Brivio
@ 2018-11-07 20:03   ` David Ahern
  2018-11-07 20:30     ` Stefano Brivio
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2018-11-07 20:03 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: netdev, Stephen Hemminger

On 11/6/18 2:39 PM, Stefano Brivio wrote:
> diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
> index 7fc0e2b4eb06..86afbe1334f0 100644
> --- a/ip/iplink_vxlan.c
> +++ b/ip/iplink_vxlan.c
> @@ -31,6 +31,7 @@ static void print_explain(FILE *f)
>  		"                 [ local ADDR ]\n"
>  		"                 [ ttl TTL ]\n"
>  		"                 [ tos TOS ]\n"
> +		"                 [ df DF ]\n"
>  		"                 [ flowlabel LABEL ]\n"
>  		"                 [ dev PHYS_DEV ]\n"
>  		"                 [ dstport PORT ]\n"

Since it is the df bit, that user option seems fine to me. Should be ok
to use that for your probe on iproute2 support.

That said, the man-page update should spell out what df refers to.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration
  2018-11-07 20:03   ` David Ahern
@ 2018-11-07 20:30     ` Stefano Brivio
  0 siblings, 0 replies; 5+ messages in thread
From: Stefano Brivio @ 2018-11-07 20:30 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, Stephen Hemminger

On Wed, 7 Nov 2018 13:03:34 -0700
David Ahern <dsahern@gmail.com> wrote:

> On 11/6/18 2:39 PM, Stefano Brivio wrote:
> > diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
> > index 7fc0e2b4eb06..86afbe1334f0 100644
> > --- a/ip/iplink_vxlan.c
> > +++ b/ip/iplink_vxlan.c
> > @@ -31,6 +31,7 @@ static void print_explain(FILE *f)
> >  		"                 [ local ADDR ]\n"
> >  		"                 [ ttl TTL ]\n"
> >  		"                 [ tos TOS ]\n"
> > +		"                 [ df DF ]\n"
> >  		"                 [ flowlabel LABEL ]\n"
> >  		"                 [ dev PHYS_DEV ]\n"
> >  		"                 [ dstport PORT ]\n"  
> 
> Since it is the df bit, that user option seems fine to me. Should be ok
> to use that for your probe on iproute2 support.

Okay, then I'll use it in v2 of the kernel series.

> That said, the man-page update should spell out what df refers to.

Sure, I'll add that.

-- 
Stefano

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-08  6:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06 21:39 [PATCH iproute2 net-next 0/2] Add DF configuration for VxLAN and GENEVE link types Stefano Brivio
2018-11-06 21:39 ` [PATCH iproute2 net-next 1/2] iplink_vxlan: Add DF configuration Stefano Brivio
2018-11-07 20:03   ` David Ahern
2018-11-07 20:30     ` Stefano Brivio
2018-11-06 21:39 ` [PATCH iproute2 net-next 2/2] iplink_geneve: " Stefano Brivio

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).