lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Mar 2018 12:20:05 -0600
From:   David Ahern <dsa@...ulusnetworks.com>
To:     Shrijeet Mukherjee <shrijeetoss@...il.com>, daniel@...earbox.net
Cc:     netdev@...r.kernel.org, roopa@...ulusnetworks.com, ast@...com
Subject: Re: [PATCH bpf-next RFC 1/2] Organize MPLS headers

On 3/28/18 10:27 AM, Shrijeet Mukherjee wrote:
> From: Shrijeet Mukherjee <shrijeet@...il.com>
> 
> Prepare shared headers for new MPLS label push/pop EBPF helpers
> 
> Signed-off-by: Shrijeet Mukherjee <shm@...ulusnetworks.com>
> ---
>  include/net/mpls.h        |  1 +
>  net/core/filter.c         |  2 ++
>  net/mpls/af_mpls.c        |  8 ++++----
>  net/mpls/internal.h       | 31 -------------------------------
>  net/mpls/mpls_iptunnel.c  |  2 +-
>  net/openvswitch/actions.c | 12 ++++++------
>  6 files changed, 14 insertions(+), 42 deletions(-)
> 
> diff --git a/include/net/mpls.h b/include/net/mpls.h
> index 1dbc669b770e..2583dbc689b8 100644
> --- a/include/net/mpls.h
> +++ b/include/net/mpls.h
> @@ -16,6 +16,7 @@
>  
>  #include <linux/if_ether.h>
>  #include <linux/netdevice.h>
> +#include <uapi/linux/mpls.h>

drop the uapi; just include linux/mpls.h

>  
>  #define MPLS_HLEN 4
>  
> diff --git a/net/core/filter.c b/net/core/filter.c
> index c86f03fd9ea5..00f62fafc788 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -29,6 +29,7 @@
>  #include <linux/sock_diag.h>
>  #include <linux/in.h>
>  #include <linux/inet.h>
> +#include <linux/mpls.h>
>  #include <linux/netdevice.h>
>  #include <linux/if_packet.h>
>  #include <linux/if_arp.h>
> @@ -56,6 +57,7 @@
>  #include <net/sock_reuseport.h>
>  #include <net/busy_poll.h>
>  #include <net/tcp.h>
> +#include <net/mpls.h>
>  #include <linux/bpf_trace.h>

Changes to this file are not needed with this patch.

>  
>  /**
> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> index d4a89a8be013..4e05391b77f0 100644
> --- a/net/mpls/af_mpls.c
> +++ b/net/mpls/af_mpls.c
> @@ -170,7 +170,7 @@ static u32 mpls_multipath_hash(struct mpls_route *rt, struct sk_buff *skb)
>  			break;
>  
>  		/* Read and decode the current label */
> -		hdr = mpls_hdr(skb) + label_index;
> +		hdr = skb_mpls_hdr(skb) + label_index;

No need to add skb_ prefix; no other protocol has the
skb_ prefix (ip_hdr, ipv6_hdr, eth_hdr, ...)


> diff --git a/net/mpls/internal.h b/net/mpls/internal.h
> index 768a302879b4..cd93cb201fed 100644
> --- a/net/mpls/internal.h
> +++ b/net/mpls/internal.h
> @@ -8,13 +8,6 @@
>   */
>  #define MAX_NEW_LABELS 30
>  
> -struct mpls_entry_decoded {
> -	u32 label;
> -	u8 ttl;
> -	u8 tc;
> -	u8 bos;
> -};
> -
>  struct mpls_pcpu_stats {
>  	struct mpls_link_stats	stats;
>  	struct u64_stats_sync	syncp;
> @@ -172,30 +165,6 @@ struct mpls_route { /* next hop label forwarding entry */
>  
>  #define endfor_nexthops(rt) }
>  
> -static inline struct mpls_shim_hdr mpls_entry_encode(u32 label, unsigned ttl, unsigned tc, bool bos)
> -{
> -	struct mpls_shim_hdr result;
> -	result.label_stack_entry =
> -		cpu_to_be32((label << MPLS_LS_LABEL_SHIFT) |
> -			    (tc << MPLS_LS_TC_SHIFT) |
> -			    (bos ? (1 << MPLS_LS_S_SHIFT) : 0) |
> -			    (ttl << MPLS_LS_TTL_SHIFT));
> -	return result;
> -}
> -
> -static inline struct mpls_entry_decoded mpls_entry_decode(struct mpls_shim_hdr *hdr)
> -{
> -	struct mpls_entry_decoded result;
> -	unsigned entry = be32_to_cpu(hdr->label_stack_entry);
> -
> -	result.label = (entry & MPLS_LS_LABEL_MASK) >> MPLS_LS_LABEL_SHIFT;
> -	result.ttl = (entry & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT;
> -	result.tc =  (entry & MPLS_LS_TC_MASK) >> MPLS_LS_TC_SHIFT;
> -	result.bos = (entry & MPLS_LS_S_MASK) >> MPLS_LS_S_SHIFT;
> -
> -	return result;
> -}
> -
>  static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev)
>  {
>  	return rcu_dereference_rtnl(dev->mpls_ptr);

With just this patch applied, MPLS can't compile since you are removing
these 2 functions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ