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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 1 Apr 2019 20:15:53 +0000
From:   Martin Lau <kafai@...com>
To:     David Ahern <dsahern@...nel.org>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "idosch@...lanox.com" <idosch@...lanox.com>,
        "David Ahern" <dsahern@...il.com>
Subject: Re: [PATCH v2 net-next 5/5] ipv6: Flip to fib_nexthop_info

On Mon, Apr 01, 2019 at 09:26:03AM -0700, David Ahern wrote:
> From: David Ahern <dsahern@...il.com>
> 
> Export fib_nexthop_info and fib_add_nexthop for use by IPv6 code.
> Remove rt6_nexthop_info and rt6_add_nexthop in favor of the IPv4
> versions. Update fib_nexthop_info for IPv6 linkdown check and
> RTA_GATEWAY for AF_INET6.
> 
> Signed-off-by: David Ahern <dsahern@...il.com>
> ---
>  include/net/ip_fib.h     |  5 ++++
>  net/ipv4/fib_semantics.c | 30 ++++++++++++++-----
>  net/ipv6/route.c         | 78 +++++-------------------------------------------
>  3 files changed, 34 insertions(+), 79 deletions(-)
> 
> diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
> index 5070bc531ca4..8f1dd5cc7be1 100644
> --- a/include/net/ip_fib.h
> +++ b/include/net/ip_fib.h
> @@ -492,4 +492,9 @@ u32 ip_mtu_from_fib_result(struct fib_result *res, __be32 daddr);
>  int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
>  			  struct fib_dump_filter *filter,
>  			  struct netlink_callback *cb);
> +
> +int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
> +		     unsigned int *flags, bool skip_oif, bool for_ipv4);
> +int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh,
> +		    int nh_weight, bool for_ipv4);
>  #endif  /* _NET_FIB_H */
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index 6a8f8cd4d6db..7e8d5ed116fe 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -45,6 +45,7 @@
>  #include <net/nexthop.h>
>  #include <net/lwtunnel.h>
>  #include <net/fib_notifier.h>
> +#include <net/addrconf.h>
>  
>  #include "fib_lookup.h"
>  
> @@ -1320,8 +1321,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
>  	return ERR_PTR(err);
>  }
>  
> -static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
> -			    unsigned int *flags, bool skip_oif)
> +int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
nh should be renamed to nhc in Patch 4?

> +		     unsigned int *flags, bool skip_oif, bool for_ipv4)
I assume "bool for_ipv4" will be used in a later patch also, can it be
removed from the current patch?

>  {
>  	if (nh->nhc_flags & RTNH_F_DEAD)
>  		*flags |= RTNH_F_DEAD;
> @@ -1335,6 +1336,10 @@ static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
>  			if (ip_ignore_linkdown(nh->nhc_dev))
>  				*flags |= RTNH_F_DEAD;
>  			break;
> +		case AF_INET6:
> +			if (ip6_ignore_linkdown(nh->nhc_dev))
> +				*flags |= RTNH_F_DEAD;
> +			break;
>  		}
>  		rcu_read_unlock();
>  	}
> @@ -1345,6 +1350,11 @@ static int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
>  			if (nla_put_in_addr(skb, RTA_GATEWAY, nh->nhc_gw.ipv4))
>  				goto nla_put_failure;
>  			break;
> +		case AF_INET6:
> +			if (nla_put_in6_addr(skb, RTA_GATEWAY,
> +					     &nh->nhc_gw.ipv6) < 0)
> +				goto nla_put_failure;
> +			break;
>  		}
>  	}
>  

[ ... ]

> -/* add multipath next hop */
> -static int rt6_add_nexthop(struct sk_buff *skb, const struct fib6_nh *fib6_nh)
> -{
> -	const struct net_device *dev = fib6_nh->fib_nh_dev;
> -	struct rtnexthop *rtnh;
> -	unsigned int flags = 0;
> -
> -	rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh));
> -	if (!rtnh)
> -		goto nla_put_failure;
> -
> -	rtnh->rtnh_hops = fib6_nh->fib_nh_weight - 1;
> -	rtnh->rtnh_ifindex = dev ? dev->ifindex : 0;
> -
> -	if (rt6_nexthop_info(skb, fib6_nh, &flags, true) < 0)
> -		goto nla_put_failure;
> -
> -	rtnh->rtnh_flags = flags;
> -
> -	/* length of rtnetlink header + attributes */
> -	rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh;
> -
> -	return 0;
> -
> -nla_put_failure:
> -	return -EMSGSIZE;
> -}
> -
>  static int rt6_fill_node(struct net *net, struct sk_buff *skb,
>  			 struct fib6_info *rt, struct dst_entry *dst,
Off topic question question,

After "net/ipv6: Flip FIB entries to fib6_info" (which was a great step forward),
any update on the followup in renaming "struct fib6_info *rt" to
"struct fib6_info *f6i"?

Powered by blists - more mailing lists