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]
Message-ID: <1374755683.29923.7.camel@cr0>
Date:	Thu, 25 Jul 2013 20:34:43 +0800
From:	Cong Wang <amwang@...hat.com>
To:	"J. Bruce Fields" <bfields@...ldses.org>
Cc:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Trond Myklebust <Trond.Myklebust@...app.com>,
	linux-nfs@...r.kernel.org
Subject: Re: [Patch net-next 4/7] sunrpc: use generic union inet_addr

On Tue, 2013-07-23 at 12:40 -0400, J. Bruce Fields wrote:
> On Mon, Jul 22, 2013 at 03:05:10PM +0800, Cong Wang wrote: 
> >  static inline unsigned short rpc_get_port(const struct sockaddr *sap)
> >  {
> > -	switch (sap->sa_family) {
> > -	case AF_INET:
> > -		return ntohs(((struct sockaddr_in *)sap)->sin_port);
> > -	case AF_INET6:
> > -		return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
> > -	}
> > -	return 0;
> > +	return inet_addr_get_port((const union inet_addr *)sap);
> >  }
> 
> Is there any reason to keep the rpc_get_port wrapper at all after this?
> Or if its still useful to have the convenience of not having to do the
> cast, maybe the wrapper should move to common code to?  (Is there some
> reason only the rpc code needs this?)
> 

Yeah, the only reason why I keep it is that I don't want to touch all
the callers of rpc_get_port(). I agree that we can make it a generic
function.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ