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:   Fri, 11 Sep 2020 18:29:39 +0300
From:   Ido Schimmel <idosch@...sch.org>
To:     David Ahern <dsahern@...il.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        roopa@...dia.com, mlxsw@...dia.com,
        Ido Schimmel <idosch@...dia.com>
Subject: Re: [RFC PATCH net-next 10/22] nexthop: Allow setting "offload" and
 "trap" indications on nexthops

On Tue, Sep 08, 2020 at 09:14:37AM -0600, David Ahern wrote:
> On 9/8/20 3:10 AM, Ido Schimmel wrote:
> > From: Ido Schimmel <idosch@...dia.com>
> > 
> > Add a function that can be called by device drivers to set "offload" or
> > "trap" indication on nexthops following nexthop notifications.
> > 
> > Signed-off-by: Ido Schimmel <idosch@...dia.com>
> > ---
> >  include/net/nexthop.h |  1 +
> >  net/ipv4/nexthop.c    | 21 +++++++++++++++++++++
> >  2 files changed, 22 insertions(+)
> > 
> > diff --git a/include/net/nexthop.h b/include/net/nexthop.h
> > index 0bde1aa867c0..4147681e86d2 100644
> > --- a/include/net/nexthop.h
> > +++ b/include/net/nexthop.h
> > @@ -146,6 +146,7 @@ struct nh_notifier_info {
> >  
> >  int register_nexthop_notifier(struct net *net, struct notifier_block *nb);
> >  int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb);
> > +void nexthop_hw_flags_set(struct net *net, u32 id, bool offload, bool trap);
> 
> how about nexthop_set_hw_flags? consistency with current nexthop_get_
> ... naming

Sure. I opted for consistency with fib_alias_hw_flags_set() and
fib6_info_hw_flags_set(), but I'll change to be consistent with nexthop
code.

> 
> >  
> >  /* caller is holding rcu or rtnl; no reference taken to nexthop */
> >  struct nexthop *nexthop_find_by_id(struct net *net, u32 id);
> > diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> > index 70c8ab6906ec..71605c612458 100644
> > --- a/net/ipv4/nexthop.c
> > +++ b/net/ipv4/nexthop.c
> > @@ -2080,6 +2080,27 @@ int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb)
> >  }
> >  EXPORT_SYMBOL(unregister_nexthop_notifier);
> >  
> > +void nexthop_hw_flags_set(struct net *net, u32 id, bool offload, bool trap)
> > +{
> > +	struct nexthop *nexthop;
> > +
> > +	rcu_read_lock();
> > +
> > +	nexthop = nexthop_find_by_id(net, id);
> > +	if (!nexthop)
> > +		goto out;
> > +
> > +	nexthop->nh_flags &= ~(RTNH_F_OFFLOAD | RTNH_F_TRAP);
> > +	if (offload)
> > +		nexthop->nh_flags |= RTNH_F_OFFLOAD;
> > +	if (trap)
> > +		nexthop->nh_flags |= RTNH_F_TRAP;
> > +
> > +out:
> > +	rcu_read_unlock();
> > +}
> > +EXPORT_SYMBOL(nexthop_hw_flags_set);
> > +
> >  static void __net_exit nexthop_net_exit(struct net *net)
> >  {
> >  	rtnl_lock();
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ