netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: "YOSHIFUJI Hideaki/吉藤英明" <hideaki.yoshifuji@miraclelinux.com>
Cc: netdev@vger.kernel.org, Dave Miller <davem@davemloft.net>,
	Pravin B Shelar <pshelar@nicira.com>,
	Jesse Gross <jesse@nicira.com>, Jiri Benc <jbenc@redhat.com>
Subject: Re: [PATCH v4 1/2] geneve: implement support for IPv6-based tunnels
Date: Wed, 21 Oct 2015 14:58:38 -0400	[thread overview]
Message-ID: <20151021185838.GA2940@tuxdriver.com> (raw)
In-Reply-To: <5626EFEB.9050906@miraclelinux.com>

On Wed, Oct 21, 2015 at 10:52:43AM +0900, YOSHIFUJI Hideaki/吉藤英明 wrote:
> Hi,

Yoshifuji-san -- thank you for taking a look at my proposed patch!

> John W. Linville wrote:
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> > ---
> > v4:
> > - treat mode field of ip_tunnel_info as flags
> > - add a missing IS_ENABLED(CONFIG_IPV6) to geneve_rx
> > - remove unneeded flags field in geneve_dev
> > - NULL-check parameter for __geneve_sock_release
> > - check remote socket family for AF_UNSPEC in geneve_configure
> > - rename geneve_get_{rt,dst} as geneve_get_{v4_rt,v6_dst}
> > - refactor some error handling in the xmit paths
> > 
> > v3:
> > - declare geneve_remote_unspec as static
> > 
> > v2:
> > - do not require remote address for tx on metadata tunnels
> > - pass correct sockaddr family to udp_tun_rx_dst in geneve_rx
> > - accommodate both ipv4 and ipv6 sockets open on same tunnel
> > - move declaration of geneve_get_dst for aesthetic purposes
> > 
> >  drivers/net/geneve.c         | 459 +++++++++++++++++++++++++++++++++++--------
> >  include/uapi/linux/if_link.h |   1 +
> >  2 files changed, 377 insertions(+), 83 deletions(-)
> > 
> > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> > index 8f5c02eed47d..217b472ab9e7 100644
> > --- a/drivers/net/geneve.c
> > +++ b/drivers/net/geneve.c
> > @@ -46,16 +46,25 @@ struct geneve_net {
> >  
> >  static int geneve_net_id;
> >  
> > +union geneve_addr {
> > +	struct sockaddr_in sin;
> > +	struct sockaddr_in6 sin6;
> > +	struct sockaddr sa;
> > +};
> > +
> > +static union geneve_addr geneve_remote_unspec = { .sa.sa_family = AF_UNSPEC, };
> > +
> >  /* Pseudo network device */
> >  struct geneve_dev {
> >  	struct hlist_node  hlist;	/* vni hash table */
> >  	struct net	   *net;	/* netns for packet i/o */
> >  	struct net_device  *dev;	/* netdev for geneve tunnel */
> > -	struct geneve_sock *sock;	/* socket used for geneve tunnel */
> > +	struct geneve_sock *sock4;	/* IPv4 socket used for geneve tunnel */
> > +	struct geneve_sock *sock6;	/* IPv6 socket used for geneve tunnel */
> >  	u8                 vni[3];	/* virtual network ID for tunnel */
> >  	u8                 ttl;		/* TTL override */
> >  	u8                 tos;		/* TOS override */
> > -	struct sockaddr_in remote;	/* IPv4 address for link partner */
> > +	union geneve_addr  remote;	/* IP address for link partner */
> >  	struct list_head   next;	/* geneve's per namespace list */
> >  	__be16		   dst_port;
> >  	bool		   collect_md;
> > @@ -103,11 +112,32 @@ static struct geneve_dev *geneve_lookup(struct geneve_sock *gs,
> >  	vni_list_head = &gs->vni_list[hash];
> >  	hlist_for_each_entry_rcu(geneve, vni_list_head, hlist) {
> >  		if (!memcmp(vni, geneve->vni, sizeof(geneve->vni)) &&
> > -		    addr == geneve->remote.sin_addr.s_addr)
> > +		    addr == geneve->remote.sin.sin_addr.s_addr)
> > +			return geneve;
> > +	}
> > +	return NULL;
> > +}
> > +
> > +#if IS_ENABLED(CONFIG_IPV6)
> > +static struct geneve_dev *geneve6_lookup(struct geneve_sock *gs,
> > +					 struct in6_addr addr6, u8 vni[])
> > +{
> > +	struct hlist_head *vni_list_head;
> > +	struct geneve_dev *geneve;
> > +	__u32 hash;
> > +
> > +	/* Find the device for this VNI */
> > +	hash = geneve_net_vni_hash(vni);
> > +	vni_list_head = &gs->vni_list[hash];
> > +	hlist_for_each_entry_rcu(geneve, vni_list_head, hlist) {
> > +		if (!memcmp(vni, geneve->vni, sizeof(geneve->vni)) &&
> > +		    !memcmp(&addr6, &geneve->remote.sin6.sin6_addr,
> > +			    sizeof(addr6)))
> 
> Please use ipv6_addr_equal().

Sure, no problem.

> How do you handle link-local addresses here?

Hmmmm...TBH, I had completely overlooked link-local addresses.
Do you have any suggestions for how to address this shortcoming?

Thanks,

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2015-10-21 19:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 18:34 [RFT] geneve: implement support for IPv6-based tunnels John W. Linville
2015-09-24 18:39 ` [PATCH iproute2] geneve: add support for IPv6 link partners John W. Linville
2015-11-24  0:23   ` Stephen Hemminger
2015-09-25 12:08 ` [RFT] geneve: implement support for IPv6-based tunnels Jiri Benc
2015-09-28 19:20   ` John W. Linville
2015-09-29 16:10     ` Jiri Benc
2015-09-30 17:04 ` [RFT v2] " John W. Linville
2015-09-30 18:07   ` kbuild test robot
2015-09-30 18:34   ` [RFT v3] " John W. Linville
2015-10-01  1:55     ` kbuild test robot
2015-10-01 15:38     ` Jiri Benc
2015-10-01 16:26     ` Jesse Gross
2015-10-01 20:03       ` John W. Linville
2015-10-01 21:07         ` Jesse Gross
2015-10-20 15:11     ` [PATCH v4 1/2] " John W. Linville
2015-10-20 15:11       ` [PATCH 2/2] geneve: handle ipv6 priority like ipv4 tos John W. Linville
2015-10-21  5:13         ` Jesse Gross
2015-10-20 22:55       ` [PATCH v4 1/2] geneve: implement support for IPv6-based tunnels kbuild test robot
2015-10-21  1:52       ` YOSHIFUJI Hideaki/吉藤英明
2015-10-21 18:58         ` John W. Linville [this message]
2015-10-21  5:06       ` Jesse Gross
2015-10-22 19:45       ` [PATCH v5 " John W. Linville
2015-10-22 19:45         ` [PATCH v5 2/2] geneve: handle ipv6 priority like ipv4 tos John W. Linville
2015-10-23  4:48         ` [PATCH v5 1/2] geneve: implement support for IPv6-based tunnels YOSHIFUJI Hideaki
2015-10-23 13:38           ` John W. Linville
2015-10-23 14:40         ` [PATCH v6 " John W. Linville
2015-10-23 14:40           ` [PATCH v6 2/2] geneve: handle ipv6 priority like ipv4 tos John W. Linville
2015-10-26  4:08           ` [PATCH v6 1/2] geneve: implement support for IPv6-based tunnels Jesse Gross
2015-10-26 21:01           ` [PATCH v7 1/3] " John W. Linville
2015-10-26 21:01             ` [PATCH v7 2/3] geneve: handle ipv6 priority like ipv4 tos John W. Linville
2015-10-30  3:11               ` David Miller
2015-10-26 21:01             ` [PATCH v7 3/3] geneve: add IPv6 bits to geneve_fill_metadata_dst John W. Linville
2015-10-27 12:48               ` Sergei Shtylyov
2015-10-27 13:49               ` [PATCH v8 " John W. Linville
2015-10-27 14:24                 ` Jesse Gross
2015-10-30  3:12                 ` David Miller
2015-10-30  3:11             ` [PATCH v7 1/3] geneve: implement support for IPv6-based tunnels David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151021185838.GA2940@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=davem@davemloft.net \
    --cc=hideaki.yoshifuji@miraclelinux.com \
    --cc=jbenc@redhat.com \
    --cc=jesse@nicira.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).