diff mbox series

[SRU,disco,1/2] ipv6: constify rt6_nexthop()

Message ID 20190826173346.7177-1-kamal@canonical.com
State New
Headers show
Series [SRU,disco,1/2] ipv6: constify rt6_nexthop() | expand

Commit Message

Kamal Mostafa Aug. 26, 2019, 5:33 p.m. UTC
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>

BugLink: https://bugs.launchpad.net/bugs/1834465

There is no functional change in this patch, it only prepares the next one.

rt6_nexthop() will be used by ip6_dst_lookup_neigh(), which uses const
variables.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reported-by: kbuild test robot <lkp@intel.com>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9b1c1ef13b35fa35051b635ca9fbda39fe6bbc70)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/vrf.c                | 2 +-
 include/net/ip6_route.h          | 4 ++--
 net/bluetooth/6lowpan.c          | 4 ++--
 net/ipv6/ip6_output.c            | 2 +-
 net/netfilter/nf_flow_table_ip.c | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

Comments

Stefan Bader Aug. 29, 2019, 3:57 p.m. UTC | #1
On 26.08.19 19:33, Kamal Mostafa wrote:
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1834465
> 
> There is no functional change in this patch, it only prepares the next one.
> 
> rt6_nexthop() will be used by ip6_dst_lookup_neigh(), which uses const
> variables.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Acked-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 9b1c1ef13b35fa35051b635ca9fbda39fe6bbc70)
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

In the bug report Nicolas states this would be affecting Xenial, too. Though it
might be much harder. While working on other things I found that there is a
certain difference between ipv6 fixes which went into newer stable and 4.4.y.

Picking into Disco/5.0 looks to be safe enough.

>  drivers/net/vrf.c                | 2 +-
>  include/net/ip6_route.h          | 4 ++--
>  net/bluetooth/6lowpan.c          | 4 ++--
>  net/ipv6/ip6_output.c            | 2 +-
>  net/netfilter/nf_flow_table_ip.c | 2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index b4ac87aa09fd..a2428976c20c 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -366,8 +366,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	nf_reset(skb);
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 7ab119936e69..eecc24cdeb0c 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -261,8 +261,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
>  	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
>  }
>  
> -static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
> -					   struct in6_addr *daddr)
> +static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
> +						 const struct in6_addr *daddr)
>  {
>  	if (rt->rt6i_flags & RTF_GATEWAY)
>  		return &rt->rt6i_gateway;
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 553dc719afde..798b49640426 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -167,10 +167,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
>  						  struct in6_addr *daddr,
>  						  struct sk_buff *skb)
>  {
> -	struct lowpan_peer *peer;
> -	struct in6_addr *nexthop;
>  	struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
>  	int count = atomic_read(&dev->peer_count);
> +	const struct in6_addr *nexthop;
> +	struct lowpan_peer *peer;
>  
>  	BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
>  
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 07224c34338b..0efba986e8f4 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -63,8 +63,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index e7c3daddeffc..1169227934e7 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -441,9 +441,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
>  	struct nf_flowtable *flow_table = priv;
>  	struct flow_offload_tuple tuple = {};
>  	enum flow_offload_tuple_dir dir;
> +	const struct in6_addr *nexthop;
>  	struct flow_offload *flow;
>  	struct net_device *outdev;
> -	struct in6_addr *nexthop;
>  	struct ipv6hdr *ip6h;
>  	struct rt6_info *rt;
>  
>
Kleber Sacilotto de Souza Sept. 2, 2019, 4:31 p.m. UTC | #2
On 8/26/19 7:33 PM, Kamal Mostafa wrote:
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1834465
> 
> There is no functional change in this patch, it only prepares the next one.
> 
> rt6_nexthop() will be used by ip6_dst_lookup_neigh(), which uses const
> variables.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Acked-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 9b1c1ef13b35fa35051b635ca9fbda39fe6bbc70)
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  drivers/net/vrf.c                | 2 +-
>  include/net/ip6_route.h          | 4 ++--
>  net/bluetooth/6lowpan.c          | 4 ++--
>  net/ipv6/ip6_output.c            | 2 +-
>  net/netfilter/nf_flow_table_ip.c | 2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index b4ac87aa09fd..a2428976c20c 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -366,8 +366,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	nf_reset(skb);
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 7ab119936e69..eecc24cdeb0c 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -261,8 +261,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
>  	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
>  }
>  
> -static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
> -					   struct in6_addr *daddr)
> +static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
> +						 const struct in6_addr *daddr)
>  {
>  	if (rt->rt6i_flags & RTF_GATEWAY)
>  		return &rt->rt6i_gateway;
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 553dc719afde..798b49640426 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -167,10 +167,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
>  						  struct in6_addr *daddr,
>  						  struct sk_buff *skb)
>  {
> -	struct lowpan_peer *peer;
> -	struct in6_addr *nexthop;
>  	struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
>  	int count = atomic_read(&dev->peer_count);
> +	const struct in6_addr *nexthop;
> +	struct lowpan_peer *peer;
>  
>  	BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
>  
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 07224c34338b..0efba986e8f4 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -63,8 +63,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index e7c3daddeffc..1169227934e7 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -441,9 +441,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
>  	struct nf_flowtable *flow_table = priv;
>  	struct flow_offload_tuple tuple = {};
>  	enum flow_offload_tuple_dir dir;
> +	const struct in6_addr *nexthop;
>  	struct flow_offload *flow;
>  	struct net_device *outdev;
> -	struct in6_addr *nexthop;
>  	struct ipv6hdr *ip6h;
>  	struct rt6_info *rt;
>  
> 

For both patches:

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Kleber Sacilotto de Souza Sept. 3, 2019, 4:26 p.m. UTC | #3
On 8/26/19 7:33 PM, Kamal Mostafa wrote:
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1834465
> 
> There is no functional change in this patch, it only prepares the next one.
> 
> rt6_nexthop() will be used by ip6_dst_lookup_neigh(), which uses const
> variables.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Acked-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 9b1c1ef13b35fa35051b635ca9fbda39fe6bbc70)
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  drivers/net/vrf.c                | 2 +-
>  include/net/ip6_route.h          | 4 ++--
>  net/bluetooth/6lowpan.c          | 4 ++--
>  net/ipv6/ip6_output.c            | 2 +-
>  net/netfilter/nf_flow_table_ip.c | 2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index b4ac87aa09fd..a2428976c20c 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -366,8 +366,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	nf_reset(skb);
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 7ab119936e69..eecc24cdeb0c 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -261,8 +261,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
>  	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
>  }
>  
> -static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
> -					   struct in6_addr *daddr)
> +static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
> +						 const struct in6_addr *daddr)
>  {
>  	if (rt->rt6i_flags & RTF_GATEWAY)
>  		return &rt->rt6i_gateway;
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 553dc719afde..798b49640426 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -167,10 +167,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
>  						  struct in6_addr *daddr,
>  						  struct sk_buff *skb)
>  {
> -	struct lowpan_peer *peer;
> -	struct in6_addr *nexthop;
>  	struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
>  	int count = atomic_read(&dev->peer_count);
> +	const struct in6_addr *nexthop;
> +	struct lowpan_peer *peer;
>  
>  	BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
>  
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 07224c34338b..0efba986e8f4 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -63,8 +63,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
>  {
>  	struct dst_entry *dst = skb_dst(skb);
>  	struct net_device *dev = dst->dev;
> +	const struct in6_addr *nexthop;
>  	struct neighbour *neigh;
> -	struct in6_addr *nexthop;
>  	int ret;
>  
>  	if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index e7c3daddeffc..1169227934e7 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -441,9 +441,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
>  	struct nf_flowtable *flow_table = priv;
>  	struct flow_offload_tuple tuple = {};
>  	enum flow_offload_tuple_dir dir;
> +	const struct in6_addr *nexthop;
>  	struct flow_offload *flow;
>  	struct net_device *outdev;
> -	struct in6_addr *nexthop;
>  	struct ipv6hdr *ip6h;
>  	struct rt6_info *rt;
>  
> 

Applied both patches to disco/master-next branch.

Thanks,
Kleber
diff mbox series

Patch

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index b4ac87aa09fd..a2428976c20c 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -366,8 +366,8 @@  static int vrf_finish_output6(struct net *net, struct sock *sk,
 {
 	struct dst_entry *dst = skb_dst(skb);
 	struct net_device *dev = dst->dev;
+	const struct in6_addr *nexthop;
 	struct neighbour *neigh;
-	struct in6_addr *nexthop;
 	int ret;
 
 	nf_reset(skb);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 7ab119936e69..eecc24cdeb0c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -261,8 +261,8 @@  static inline bool ip6_sk_ignore_df(const struct sock *sk)
 	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
 }
 
-static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
-					   struct in6_addr *daddr)
+static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
+						 const struct in6_addr *daddr)
 {
 	if (rt->rt6i_flags & RTF_GATEWAY)
 		return &rt->rt6i_gateway;
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 553dc719afde..798b49640426 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -167,10 +167,10 @@  static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
 						  struct in6_addr *daddr,
 						  struct sk_buff *skb)
 {
-	struct lowpan_peer *peer;
-	struct in6_addr *nexthop;
 	struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
 	int count = atomic_read(&dev->peer_count);
+	const struct in6_addr *nexthop;
+	struct lowpan_peer *peer;
 
 	BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
 
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 07224c34338b..0efba986e8f4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -63,8 +63,8 @@  static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
 {
 	struct dst_entry *dst = skb_dst(skb);
 	struct net_device *dev = dst->dev;
+	const struct in6_addr *nexthop;
 	struct neighbour *neigh;
-	struct in6_addr *nexthop;
 	int ret;
 
 	if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index e7c3daddeffc..1169227934e7 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -441,9 +441,9 @@  nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
 	struct nf_flowtable *flow_table = priv;
 	struct flow_offload_tuple tuple = {};
 	enum flow_offload_tuple_dir dir;
+	const struct in6_addr *nexthop;
 	struct flow_offload *flow;
 	struct net_device *outdev;
-	struct in6_addr *nexthop;
 	struct ipv6hdr *ip6h;
 	struct rt6_info *rt;