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] [day] [month] [year] [list]
Message-ID: <577e7f43f2a54ac597d23739822d8674@huawei.com>
Date:   Thu, 29 Sep 2022 13:38:05 +0000
From:   "liujian (CE)" <liujian56@...wei.com>
To:     Paolo Abeni <pabeni@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "yoshfuji@...ux-ipv6.org" <yoshfuji@...ux-ipv6.org>,
        "dsahern@...nel.org" <dsahern@...nel.org>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next v2 2/2] net: Add helper function to parse netlink
 msg of ip_tunnel_parm



> -----Original Message-----
> From: Paolo Abeni [mailto:pabeni@...hat.com]
> Sent: Thursday, September 29, 2022 9:17 PM
> To: liujian (CE) <liujian56@...wei.com>; davem@...emloft.net;
> yoshfuji@...ux-ipv6.org; dsahern@...nel.org; edumazet@...gle.com;
> kuba@...nel.org; netdev@...r.kernel.org
> Subject: Re: [PATCH net-next v2 2/2] net: Add helper function to parse
> netlink msg of ip_tunnel_parm
> 
> On Wed, 2022-09-28 at 11:39 +0800, Liu Jian wrote:
> > Add ip_tunnel_netlink_parms to parse netlink msg of ip_tunnel_parm.
> > Reduces duplicate code, no actual functional changes.
> >
> > Signed-off-by: Liu Jian <liujian56@...wei.com>
> > ---
> > v1->v2: Move the implementation of the helper function to
> > v1->ip_tunnel_core.c
> >  include/net/ip_tunnels.h  |  3 +++
> >  net/ipv4/ip_tunnel_core.c | 32 ++++++++++++++++++++++++++++++++
> >  net/ipv4/ipip.c           | 24 +-----------------------
> >  net/ipv6/sit.c            | 27 +--------------------------
> >  4 files changed, 37 insertions(+), 49 deletions(-)
> >
> > diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index
> > 51da2957cf48..fca357679816 100644
> > --- a/include/net/ip_tunnels.h
> > +++ b/include/net/ip_tunnels.h
> > @@ -305,6 +305,9 @@ void ip_tunnel_setup(struct net_device *dev,
> > unsigned int net_id);  bool ip_tunnel_netlink_encap_parms(struct nlattr
> *data[],
> >  				   struct ip_tunnel_encap *encap);
> >
> > +void ip_tunnel_netlink_parms(struct nlattr *data[],
> > +			     struct ip_tunnel_parm *parms);
> > +
> >  extern const struct header_ops ip_tunnel_header_ops;
> >  __be16 ip_tunnel_parse_protocol(const struct sk_buff *skb);
> >
> > diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
> > index 526e6a52a973..1e1217e87885 100644
> > --- a/net/ipv4/ip_tunnel_core.c
> > +++ b/net/ipv4/ip_tunnel_core.c
> > @@ -1114,3 +1114,35 @@ bool ip_tunnel_netlink_encap_parms(struct
> nlattr *data[],
> >  	return ret;
> >  }
> >  EXPORT_SYMBOL(ip_tunnel_netlink_encap_parms);
> > +
> > +void ip_tunnel_netlink_parms(struct nlattr *data[],
> > +			     struct ip_tunnel_parm *parms) {
> > +	if (data[IFLA_IPTUN_LINK])
> > +		parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
> > +
> > +	if (data[IFLA_IPTUN_LOCAL])
> > +		parms->iph.saddr = nla_get_be32(data[IFLA_IPTUN_LOCAL]);
> > +
> > +	if (data[IFLA_IPTUN_REMOTE])
> > +		parms->iph.daddr =
> nla_get_be32(data[IFLA_IPTUN_REMOTE]);
> > +
> > +	if (data[IFLA_IPTUN_TTL]) {
> > +		parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]);
> > +		if (parms->iph.ttl)
> > +			parms->iph.frag_off = htons(IP_DF);
> > +	}
> > +
> > +	if (data[IFLA_IPTUN_TOS])
> > +		parms->iph.tos = nla_get_u8(data[IFLA_IPTUN_TOS]);
> > +
> > +	if (!data[IFLA_IPTUN_PMTUDISC] ||
> nla_get_u8(data[IFLA_IPTUN_PMTUDISC]))
> > +		parms->iph.frag_off = htons(IP_DF);
> > +
> > +	if (data[IFLA_IPTUN_FLAGS])
> > +		parms->i_flags = nla_get_be16(data[IFLA_IPTUN_FLAGS]);
> > +
> > +	if (data[IFLA_IPTUN_PROTO])
> > +		parms->iph.protocol =
> nla_get_u8(data[IFLA_IPTUN_PROTO]);
> > +}
> > +EXPORT_SYMBOL(ip_tunnel_netlink_parms);
> 
> The same here, I think it should be EXPORT_SYMBOL_GPL()
OK, thanks for your review, I will send v3 for this.
> 
> Thanks,
> 
> Paolo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ