All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] mpls: Move reserved label definitions
@ 2015-05-05 16:06 Tom Herbert
  2015-05-05 23:41 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tom Herbert @ 2015-05-05 16:06 UTC (permalink / raw)
  To: davem, ebiederm, netdev

Move to include/uapi/linux/mpls.h to be externally visibile.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 include/uapi/linux/mpls.h | 10 ++++++++++
 net/mpls/af_mpls.c        | 18 +++++++++---------
 net/mpls/internal.h       | 10 ----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
index bc9abfe..0fe6ea5 100644
--- a/include/uapi/linux/mpls.h
+++ b/include/uapi/linux/mpls.h
@@ -31,4 +31,14 @@ struct mpls_label {
 #define MPLS_LS_TTL_MASK        0x000000FF
 #define MPLS_LS_TTL_SHIFT       0
 
+/* Reserved labels */
+#define MPLS_LABEL_IPV4_EXPLICIT_NULL	0 /* RFC3032 */
+#define MPLS_LABEL_ROUTER_ALERT		1 /* RFC3032 */
+#define MPLS_LABEL_IPV6_EXPLICIT_NULL	2 /* RFC3032 */
+#define MPLS_LABEL_IMPLICIT_NULL	3 /* RFC3032 */
+#define MPLS_LABEL_ENTROPY_INDICATOR	7 /* RFC6790 */
+#define MPLS_LABEL_GAL			13 /* RFC5586 */
+#define MPLS_LABEL_OAM_ALERT		14 /* RFC3429 */
+#define MPLS_LABEL_EXTENSION		15 /* RFC7274 */
+
 #endif /* _UAPI_MPLS_H */
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 954810c..b6eb761 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -647,7 +647,7 @@ int nla_get_labels(const struct nlattr *nla,
 			return -EINVAL;
 
 		switch (dec.label) {
-		case LABEL_IMPLICIT_NULL:
+		case MPLS_LABEL_IMPLICIT_NULL:
 			/* RFC3032: This is a label that an LSR may
 			 * assign and distribute, but which never
 			 * actually appears in the encapsulation.
@@ -935,7 +935,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
 	}
 
 	/* In case the predefined labels need to be populated */
-	if (limit > LABEL_IPV4_EXPLICIT_NULL) {
+	if (limit > MPLS_LABEL_IPV4_EXPLICIT_NULL) {
 		struct net_device *lo = net->loopback_dev;
 		rt0 = mpls_rt_alloc(lo->addr_len);
 		if (!rt0)
@@ -945,7 +945,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
 		rt0->rt_via_table = NEIGH_LINK_TABLE;
 		memcpy(rt0->rt_via, lo->dev_addr, lo->addr_len);
 	}
-	if (limit > LABEL_IPV6_EXPLICIT_NULL) {
+	if (limit > MPLS_LABEL_IPV6_EXPLICIT_NULL) {
 		struct net_device *lo = net->loopback_dev;
 		rt2 = mpls_rt_alloc(lo->addr_len);
 		if (!rt2)
@@ -973,15 +973,15 @@ static int resize_platform_label_table(struct net *net, size_t limit)
 	memcpy(labels, old, cp_size);
 
 	/* If needed set the predefined labels */
-	if ((old_limit <= LABEL_IPV6_EXPLICIT_NULL) &&
-	    (limit > LABEL_IPV6_EXPLICIT_NULL)) {
-		RCU_INIT_POINTER(labels[LABEL_IPV6_EXPLICIT_NULL], rt2);
+	if ((old_limit <= MPLS_LABEL_IPV6_EXPLICIT_NULL) &&
+	    (limit > MPLS_LABEL_IPV6_EXPLICIT_NULL)) {
+		RCU_INIT_POINTER(labels[MPLS_LABEL_IPV6_EXPLICIT_NULL], rt2);
 		rt2 = NULL;
 	}
 
-	if ((old_limit <= LABEL_IPV4_EXPLICIT_NULL) &&
-	    (limit > LABEL_IPV4_EXPLICIT_NULL)) {
-		RCU_INIT_POINTER(labels[LABEL_IPV4_EXPLICIT_NULL], rt0);
+	if ((old_limit <= MPLS_LABEL_IPV4_EXPLICIT_NULL) &&
+	    (limit > MPLS_LABEL_IPV4_EXPLICIT_NULL)) {
+		RCU_INIT_POINTER(labels[MPLS_LABEL_IPV4_EXPLICIT_NULL], rt0);
 		rt0 = NULL;
 	}
 
diff --git a/net/mpls/internal.h b/net/mpls/internal.h
index 693877d..b064c34 100644
--- a/net/mpls/internal.h
+++ b/net/mpls/internal.h
@@ -1,16 +1,6 @@
 #ifndef MPLS_INTERNAL_H
 #define MPLS_INTERNAL_H
 
-#define LABEL_IPV4_EXPLICIT_NULL	0 /* RFC3032 */
-#define LABEL_ROUTER_ALERT_LABEL	1 /* RFC3032 */
-#define LABEL_IPV6_EXPLICIT_NULL	2 /* RFC3032 */
-#define LABEL_IMPLICIT_NULL		3 /* RFC3032 */
-#define LABEL_ENTROPY_INDICATOR		7 /* RFC6790 */
-#define LABEL_GAL			13 /* RFC5586 */
-#define LABEL_OAM_ALERT			14 /* RFC3429 */
-#define LABEL_EXTENSION			15 /* RFC7274 */
-
-
 struct mpls_shim_hdr {
 	__be32 label_stack_entry;
 };
-- 
1.8.1

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

* Re: [PATCH net-next] mpls: Move reserved label definitions
  2015-05-05 16:06 [PATCH net-next] mpls: Move reserved label definitions Tom Herbert
@ 2015-05-05 23:41 ` David Miller
  2015-05-06 21:07 ` Eric W. Biederman
  2015-05-06 22:16 ` Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-05-05 23:41 UTC (permalink / raw)
  To: tom; +Cc: ebiederm, netdev

From: Tom Herbert <tom@herbertland.com>
Date: Tue, 5 May 2015 09:06:30 -0700

> Move to include/uapi/linux/mpls.h to be externally visibile.
> 
> Signed-off-by: Tom Herbert <tom@herbertland.com>

If we want to propagate this into the user header file, we should
do so ASAP, so I've applied this to 'net' instead of 'net-next'.

Thanks Tom.

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

* Re: [PATCH net-next] mpls: Move reserved label definitions
  2015-05-05 16:06 [PATCH net-next] mpls: Move reserved label definitions Tom Herbert
  2015-05-05 23:41 ` David Miller
@ 2015-05-06 21:07 ` Eric W. Biederman
  2015-05-06 22:16 ` Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: Eric W. Biederman @ 2015-05-06 21:07 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

Tom Herbert <tom@herbertland.com> writes:

> Move to include/uapi/linux/mpls.h to be externally visibile.

Quick question.

Have you looked to see if any of the BSD's provide any of these
definitions?    I believe the existing macros in this header are
used by tcpdump and are used by the bsds.

I am just thinking if there was already similar definitions in different
unices it would be polite to ensure we have the names in sync.

Eric

> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
>  include/uapi/linux/mpls.h | 10 ++++++++++
>  net/mpls/af_mpls.c        | 18 +++++++++---------
>  net/mpls/internal.h       | 10 ----------
>  3 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
> index bc9abfe..0fe6ea5 100644
> --- a/include/uapi/linux/mpls.h
> +++ b/include/uapi/linux/mpls.h
> @@ -31,4 +31,14 @@ struct mpls_label {
>  #define MPLS_LS_TTL_MASK        0x000000FF
>  #define MPLS_LS_TTL_SHIFT       0
>  
> +/* Reserved labels */
> +#define MPLS_LABEL_IPV4_EXPLICIT_NULL	0 /* RFC3032 */
> +#define MPLS_LABEL_ROUTER_ALERT		1 /* RFC3032 */
> +#define MPLS_LABEL_IPV6_EXPLICIT_NULL	2 /* RFC3032 */
> +#define MPLS_LABEL_IMPLICIT_NULL	3 /* RFC3032 */
> +#define MPLS_LABEL_ENTROPY_INDICATOR	7 /* RFC6790 */
> +#define MPLS_LABEL_GAL			13 /* RFC5586 */
> +#define MPLS_LABEL_OAM_ALERT		14 /* RFC3429 */
> +#define MPLS_LABEL_EXTENSION		15 /* RFC7274 */
> +
>  #endif /* _UAPI_MPLS_H */
> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> index 954810c..b6eb761 100644
> --- a/net/mpls/af_mpls.c
> +++ b/net/mpls/af_mpls.c
> @@ -647,7 +647,7 @@ int nla_get_labels(const struct nlattr *nla,
>  			return -EINVAL;
>  
>  		switch (dec.label) {
> -		case LABEL_IMPLICIT_NULL:
> +		case MPLS_LABEL_IMPLICIT_NULL:
>  			/* RFC3032: This is a label that an LSR may
>  			 * assign and distribute, but which never
>  			 * actually appears in the encapsulation.
> @@ -935,7 +935,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
>  	}
>  
>  	/* In case the predefined labels need to be populated */
> -	if (limit > LABEL_IPV4_EXPLICIT_NULL) {
> +	if (limit > MPLS_LABEL_IPV4_EXPLICIT_NULL) {
>  		struct net_device *lo = net->loopback_dev;
>  		rt0 = mpls_rt_alloc(lo->addr_len);
>  		if (!rt0)
> @@ -945,7 +945,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
>  		rt0->rt_via_table = NEIGH_LINK_TABLE;
>  		memcpy(rt0->rt_via, lo->dev_addr, lo->addr_len);
>  	}
> -	if (limit > LABEL_IPV6_EXPLICIT_NULL) {
> +	if (limit > MPLS_LABEL_IPV6_EXPLICIT_NULL) {
>  		struct net_device *lo = net->loopback_dev;
>  		rt2 = mpls_rt_alloc(lo->addr_len);
>  		if (!rt2)
> @@ -973,15 +973,15 @@ static int resize_platform_label_table(struct net *net, size_t limit)
>  	memcpy(labels, old, cp_size);
>  
>  	/* If needed set the predefined labels */
> -	if ((old_limit <= LABEL_IPV6_EXPLICIT_NULL) &&
> -	    (limit > LABEL_IPV6_EXPLICIT_NULL)) {
> -		RCU_INIT_POINTER(labels[LABEL_IPV6_EXPLICIT_NULL], rt2);
> +	if ((old_limit <= MPLS_LABEL_IPV6_EXPLICIT_NULL) &&
> +	    (limit > MPLS_LABEL_IPV6_EXPLICIT_NULL)) {
> +		RCU_INIT_POINTER(labels[MPLS_LABEL_IPV6_EXPLICIT_NULL], rt2);
>  		rt2 = NULL;
>  	}
>  
> -	if ((old_limit <= LABEL_IPV4_EXPLICIT_NULL) &&
> -	    (limit > LABEL_IPV4_EXPLICIT_NULL)) {
> -		RCU_INIT_POINTER(labels[LABEL_IPV4_EXPLICIT_NULL], rt0);
> +	if ((old_limit <= MPLS_LABEL_IPV4_EXPLICIT_NULL) &&
> +	    (limit > MPLS_LABEL_IPV4_EXPLICIT_NULL)) {
> +		RCU_INIT_POINTER(labels[MPLS_LABEL_IPV4_EXPLICIT_NULL], rt0);
>  		rt0 = NULL;
>  	}
>  
> diff --git a/net/mpls/internal.h b/net/mpls/internal.h
> index 693877d..b064c34 100644
> --- a/net/mpls/internal.h
> +++ b/net/mpls/internal.h
> @@ -1,16 +1,6 @@
>  #ifndef MPLS_INTERNAL_H
>  #define MPLS_INTERNAL_H
>  
> -#define LABEL_IPV4_EXPLICIT_NULL	0 /* RFC3032 */
> -#define LABEL_ROUTER_ALERT_LABEL	1 /* RFC3032 */
> -#define LABEL_IPV6_EXPLICIT_NULL	2 /* RFC3032 */
> -#define LABEL_IMPLICIT_NULL		3 /* RFC3032 */
> -#define LABEL_ENTROPY_INDICATOR		7 /* RFC6790 */
> -#define LABEL_GAL			13 /* RFC5586 */
> -#define LABEL_OAM_ALERT			14 /* RFC3429 */
> -#define LABEL_EXTENSION			15 /* RFC7274 */
> -
> -
>  struct mpls_shim_hdr {
>  	__be32 label_stack_entry;
>  };

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

* Re: [PATCH net-next] mpls: Move reserved label definitions
  2015-05-05 16:06 [PATCH net-next] mpls: Move reserved label definitions Tom Herbert
  2015-05-05 23:41 ` David Miller
  2015-05-06 21:07 ` Eric W. Biederman
@ 2015-05-06 22:16 ` Stephen Hemminger
  2015-05-06 22:50   ` Eric W. Biederman
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2015-05-06 22:16 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, ebiederm, netdev

On Tue, 5 May 2015 09:06:30 -0700
Tom Herbert <tom@herbertland.com> wrote:

> Move to include/uapi/linux/mpls.h to be externally visibile.
> 
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
>  include/uapi/linux/mpls.h | 10 ++++++++++
>  net/mpls/af_mpls.c        | 18 +++++++++---------
>  net/mpls/internal.h       | 10 ----------
>  3 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h

You need to update include/uapi/linux/Kbuild to cause header
to be exported.

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

* Re: [PATCH net-next] mpls: Move reserved label definitions
  2015-05-06 22:16 ` Stephen Hemminger
@ 2015-05-06 22:50   ` Eric W. Biederman
  0 siblings, 0 replies; 5+ messages in thread
From: Eric W. Biederman @ 2015-05-06 22:50 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Tom Herbert, davem, netdev

Stephen Hemminger <stephen@networkplumber.org> writes:

> On Tue, 5 May 2015 09:06:30 -0700
> Tom Herbert <tom@herbertland.com> wrote:
>
>> Move to include/uapi/linux/mpls.h to be externally visibile.
>> 
>> Signed-off-by: Tom Herbert <tom@herbertland.com>
>> ---
>>  include/uapi/linux/mpls.h | 10 ++++++++++
>>  net/mpls/af_mpls.c        | 18 +++++++++---------
>>  net/mpls/internal.h       | 10 ----------
>>  3 files changed, 19 insertions(+), 19 deletions(-)
>> 
>> diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
>
> You need to update include/uapi/linux/Kbuild to cause header
> to be exported.

This header is already exported in include/uapi/linux/Kbuild and
has been since before the recent mpls work.

Eric

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

end of thread, other threads:[~2015-05-06 22:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-05 16:06 [PATCH net-next] mpls: Move reserved label definitions Tom Herbert
2015-05-05 23:41 ` David Miller
2015-05-06 21:07 ` Eric W. Biederman
2015-05-06 22:16 ` Stephen Hemminger
2015-05-06 22:50   ` Eric W. Biederman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.