* [PATCH] iplink_geneve: add UDP destination port configuration at link creation
@ 2015-09-17 19:27 John W. Linville
2015-09-17 20:49 ` Eric Dumazet
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
0 siblings, 2 replies; 12+ messages in thread
From: John W. Linville @ 2015-09-17 19:27 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Pravin B Shelar, John W. Linville
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
I didn't see an iproute2 patch posted for this option, so here is my version...
ip/iplink_geneve.c | 13 +++++++++++++
man/man8/ip-link.8.in | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
index 331240a6a3d9..0a45647844f5 100644
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -19,6 +19,7 @@ static void print_explain(FILE *f)
{
fprintf(f, "Usage: ... geneve id VNI remote ADDR\n");
fprintf(f, " [ ttl TTL ] [ tos TOS ]\n");
+ fprintf(f, " [ dstport PORT ]\n");
fprintf(f, "\n");
fprintf(f, "Where: VNI := 0-16777215\n");
fprintf(f, " ADDR := IP_ADDRESS\n");
@@ -40,6 +41,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
__u8 ttl = 0;
__u8 tos = 0;
+ __u16 dstport = 0;
while (argc > 0) {
if (!matches(*argv, "id") ||
@@ -80,6 +82,10 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
tos = uval;
} else
tos = 1;
+ } else if (!matches(*argv, "dstport")){
+ NEXT_ARG();
+ if (get_u16(&dstport, *argv, 0))
+ invarg("dst port", *argv);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
@@ -111,6 +117,9 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
addattr8(n, 1024, IFLA_GENEVE_TOS, tos);
+ if (dstport)
+ addattr16(n, 1024, IFLA_GENEVE_PORT, htons(dstport));
+
return 0;
}
@@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
else
fprintf(f, "tos %#x ", tos);
}
+
+ if (tb[IFLA_GENEVE_PORT])
+ fprintf(f, "dstport %u ",
+ ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
}
static void geneve_print_help(struct link_util *lu, int argc, char **argv,
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 1896eb6f185e..2e1889af650e 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -747,6 +747,8 @@ the following additional arguments are supported:
.BI ttl " TTL "
.R " ] [ "
.BI tos " TOS "
+.R " ] [ "
+.BI dstport " PORT "
.R " ]"
.in +8
@@ -766,6 +768,10 @@ the following additional arguments are supported:
.BI tos " TOS"
- specifies the TOS value to use in outgoing packets.
+.sp
+.BI dstport " PORT "
+- specifies the UDP destination port to communicate at both ends of the GENEVE tunnel.
+
.in -8
.SS ip link delete - delete virtual link
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] iplink_geneve: add UDP destination port configuration at link creation
2015-09-17 19:27 [PATCH] iplink_geneve: add UDP destination port configuration at link creation John W. Linville
@ 2015-09-17 20:49 ` Eric Dumazet
2015-09-18 14:26 ` John W. Linville
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
1 sibling, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2015-09-17 20:49 UTC (permalink / raw)
To: John W. Linville; +Cc: netdev, Stephen Hemminger, Pravin B Shelar
On Thu, 2015-09-17 at 15:27 -0400, John W. Linville wrote:
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
> }
>
> @@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
> else
> fprintf(f, "tos %#x ", tos);
> }
> +
> + if (tb[IFLA_GENEVE_PORT])
> + fprintf(f, "dstport %u ",
> + ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
This looks strange.
Kernel does :
if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
goto nla_put_failure;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iplink_geneve: add UDP destination port configuration at link creation
2015-09-17 20:49 ` Eric Dumazet
@ 2015-09-18 14:26 ` John W. Linville
2015-09-18 14:45 ` Eric Dumazet
0 siblings, 1 reply; 12+ messages in thread
From: John W. Linville @ 2015-09-18 14:26 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Stephen Hemminger, Pravin B Shelar
On Thu, Sep 17, 2015 at 01:49:49PM -0700, Eric Dumazet wrote:
> On Thu, 2015-09-17 at 15:27 -0400, John W. Linville wrote:
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> > ---
>
> > }
> >
> > @@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
> > else
> > fprintf(f, "tos %#x ", tos);
> > }
> > +
> > + if (tb[IFLA_GENEVE_PORT])
> > + fprintf(f, "dstport %u ",
> > + ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
>
> This looks strange.
>
> Kernel does :
>
> if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
> goto nla_put_failure;
Indeed, you are right. I had essentially copied some vxlan code when
I did my version of adding the port attribute, and didn't take much
care when adapting that code for the version that actually got merged.
The current geneve code is using host byte-order for the UDP port in
the netlink messages. But, I see that vxlan, gre, iptnl, etc are using
network byte order for specifying UDP ports in their netlink stuff.
Should geneve follow that practice as well? Or does it matter?
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iplink_geneve: add UDP destination port configuration at link creation
2015-09-18 14:26 ` John W. Linville
@ 2015-09-18 14:45 ` Eric Dumazet
2015-09-18 16:15 ` Jesse Gross
0 siblings, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2015-09-18 14:45 UTC (permalink / raw)
To: John W. Linville; +Cc: netdev, Stephen Hemminger, Pravin B Shelar
On Fri, 2015-09-18 at 10:26 -0400, John W. Linville wrote:
> On Thu, Sep 17, 2015 at 01:49:49PM -0700, Eric Dumazet wrote:
> > On Thu, 2015-09-17 at 15:27 -0400, John W. Linville wrote:
> > > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> > > ---
> >
> > > }
> > >
> > > @@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
> > > else
> > > fprintf(f, "tos %#x ", tos);
> > > }
> > > +
> > > + if (tb[IFLA_GENEVE_PORT])
> > > + fprintf(f, "dstport %u ",
> > > + ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
> >
> > This looks strange.
> >
> > Kernel does :
> >
> > if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
> > goto nla_put_failure;
>
> Indeed, you are right. I had essentially copied some vxlan code when
> I did my version of adding the port attribute, and didn't take much
> care when adapting that code for the version that actually got merged.
>
> The current geneve code is using host byte-order for the UDP port in
> the netlink messages. But, I see that vxlan, gre, iptnl, etc are using
> network byte order for specifying UDP ports in their netlink stuff.
> Should geneve follow that practice as well? Or does it matter?
It might be too late to change the ABI, as geneve is in linux-4.2
Keep current host order in netlink messages and respin your iproute2
patch, and maybe add a comment to explain difference for a casual
reader ?
Thanks !
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iplink_geneve: add UDP destination port configuration at link creation
2015-09-18 14:45 ` Eric Dumazet
@ 2015-09-18 16:15 ` Jesse Gross
2015-09-18 18:39 ` John W. Linville
0 siblings, 1 reply; 12+ messages in thread
From: Jesse Gross @ 2015-09-18 16:15 UTC (permalink / raw)
To: Eric Dumazet; +Cc: John W. Linville, netdev, Stephen Hemminger, Pravin B Shelar
On Fri, Sep 18, 2015 at 7:45 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2015-09-18 at 10:26 -0400, John W. Linville wrote:
>> On Thu, Sep 17, 2015 at 01:49:49PM -0700, Eric Dumazet wrote:
>> > On Thu, 2015-09-17 at 15:27 -0400, John W. Linville wrote:
>> > > Signed-off-by: John W. Linville <linville@tuxdriver.com>
>> > > ---
>> >
>> > > }
>> > >
>> > > @@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
>> > > else
>> > > fprintf(f, "tos %#x ", tos);
>> > > }
>> > > +
>> > > + if (tb[IFLA_GENEVE_PORT])
>> > > + fprintf(f, "dstport %u ",
>> > > + ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
>> >
>> > This looks strange.
>> >
>> > Kernel does :
>> >
>> > if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
>> > goto nla_put_failure;
>>
>> Indeed, you are right. I had essentially copied some vxlan code when
>> I did my version of adding the port attribute, and didn't take much
>> care when adapting that code for the version that actually got merged.
>>
>> The current geneve code is using host byte-order for the UDP port in
>> the netlink messages. But, I see that vxlan, gre, iptnl, etc are using
>> network byte order for specifying UDP ports in their netlink stuff.
>> Should geneve follow that practice as well? Or does it matter?
>
> It might be too late to change the ABI, as geneve is in linux-4.2
We might be in luck actually. Geneve itself came earlier but I think
the ability to specify the dest port is in 4.3 only, so we still have
a chance to make it consistent.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] iplink_geneve: add UDP destination port configuration at link creation
2015-09-18 16:15 ` Jesse Gross
@ 2015-09-18 18:39 ` John W. Linville
0 siblings, 0 replies; 12+ messages in thread
From: John W. Linville @ 2015-09-18 18:39 UTC (permalink / raw)
To: Jesse Gross; +Cc: Eric Dumazet, netdev, Stephen Hemminger, Pravin B Shelar
On Fri, Sep 18, 2015 at 09:15:56AM -0700, Jesse Gross wrote:
> On Fri, Sep 18, 2015 at 7:45 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > On Fri, 2015-09-18 at 10:26 -0400, John W. Linville wrote:
> >> On Thu, Sep 17, 2015 at 01:49:49PM -0700, Eric Dumazet wrote:
> >> > On Thu, 2015-09-17 at 15:27 -0400, John W. Linville wrote:
> >> > > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> >> > > ---
> >> >
> >> > > }
> >> > >
> >> > > @@ -150,6 +159,10 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
> >> > > else
> >> > > fprintf(f, "tos %#x ", tos);
> >> > > }
> >> > > +
> >> > > + if (tb[IFLA_GENEVE_PORT])
> >> > > + fprintf(f, "dstport %u ",
> >> > > + ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT])));
> >> >
> >> > This looks strange.
> >> >
> >> > Kernel does :
> >> >
> >> > if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
> >> > goto nla_put_failure;
> >>
> >> Indeed, you are right. I had essentially copied some vxlan code when
> >> I did my version of adding the port attribute, and didn't take much
> >> care when adapting that code for the version that actually got merged.
> >>
> >> The current geneve code is using host byte-order for the UDP port in
> >> the netlink messages. But, I see that vxlan, gre, iptnl, etc are using
> >> network byte order for specifying UDP ports in their netlink stuff.
> >> Should geneve follow that practice as well? Or does it matter?
> >
> > It might be too late to change the ABI, as geneve is in linux-4.2
>
> We might be in luck actually. Geneve itself came earlier but I think
> the ability to specify the dest port is in 4.3 only, so we still have
> a chance to make it consistent.
Right, that's what I was thinking. So we are agreed to use network
byte order? I'll be happy to post a patch.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] geneve: use network byte order for destination port config parameter
2015-09-17 19:27 [PATCH] iplink_geneve: add UDP destination port configuration at link creation John W. Linville
2015-09-17 20:49 ` Eric Dumazet
@ 2015-09-18 19:59 ` John W. Linville
2015-09-18 20:14 ` Jesse Gross
2015-09-21 23:24 ` David Miller
1 sibling, 2 replies; 12+ messages in thread
From: John W. Linville @ 2015-09-18 19:59 UTC (permalink / raw)
To: netdev
Cc: davem, Pravin B Shelar, Eric Dumazet, Jesse Gross,
Stephen Hemminger, John W. Linville
This is primarily for consistancy with vxlan and other tunnels which
use network byte order for similar parameters.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
It is OK to change this, since this parameter was introduced to
net-next in the pre-4.3 cycle. Using network byte order for this
parameter is consistent with what the other tunnels are doing.
drivers/net/geneve.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 50f551a69dcb..34cfeacba149 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1049,7 +1049,7 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn,
static int geneve_configure(struct net *net, struct net_device *dev,
union geneve_addr *remote,
- __u32 vni, __u8 ttl, __u8 tos, __u16 dst_port,
+ __u32 vni, __u8 ttl, __u8 tos, __be16 dst_port,
bool metadata)
{
struct geneve_net *gn = net_generic(net, geneve_net_id);
@@ -1083,10 +1083,10 @@ static int geneve_configure(struct net *net, struct net_device *dev,
geneve->ttl = ttl;
geneve->tos = tos;
- geneve->dst_port = htons(dst_port);
+ geneve->dst_port = dst_port;
geneve->collect_md = metadata;
- t = geneve_find_dev(gn, htons(dst_port), remote, geneve->vni,
+ t = geneve_find_dev(gn, dst_port, remote, geneve->vni,
&tun_on_same_port, &tun_collect_md);
if (t)
return -EBUSY;
@@ -1110,7 +1110,7 @@ static int geneve_configure(struct net *net, struct net_device *dev,
static int geneve_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
- __u16 dst_port = GENEVE_UDP_PORT;
+ __be16 dst_port = htons(GENEVE_UDP_PORT);
__u8 ttl = 0, tos = 0;
bool metadata = false;
union geneve_addr remote;
@@ -1144,7 +1144,7 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
tos = nla_get_u8(data[IFLA_GENEVE_TOS]);
if (data[IFLA_GENEVE_PORT])
- dst_port = nla_get_u16(data[IFLA_GENEVE_PORT]);
+ dst_port = nla_get_be16(data[IFLA_GENEVE_PORT]);
if (data[IFLA_GENEVE_COLLECT_METADATA])
metadata = true;
@@ -1167,7 +1167,7 @@ static size_t geneve_get_size(const struct net_device *dev)
nla_total_size(sizeof(struct in6_addr)) + /* IFLA_GENEVE_REMOTE{6} */
nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TTL */
nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TOS */
- nla_total_size(sizeof(__u16)) + /* IFLA_GENEVE_PORT */
+ nla_total_size(sizeof(__be16)) + /* IFLA_GENEVE_PORT */
nla_total_size(0) + /* IFLA_GENEVE_COLLECT_METADATA */
0;
}
@@ -1197,7 +1197,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
nla_put_u8(skb, IFLA_GENEVE_TOS, geneve->tos))
goto nla_put_failure;
- if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
+ if (nla_put_be16(skb, IFLA_GENEVE_PORT, geneve->dst_port))
goto nla_put_failure;
if (geneve->collect_md) {
@@ -1238,7 +1238,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
return dev;
err = geneve_configure(net, dev, &geneve_remote_unspec,
- 0, 0, 0, dst_port, true);
+ 0, 0, 0, htons(dst_port), true);
if (err) {
free_netdev(dev);
return ERR_PTR(err);
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] geneve: use network byte order for destination port config parameter
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
@ 2015-09-18 20:14 ` Jesse Gross
2015-09-21 23:24 ` David Miller
1 sibling, 0 replies; 12+ messages in thread
From: Jesse Gross @ 2015-09-18 20:14 UTC (permalink / raw)
To: John W. Linville
Cc: netdev, David Miller, Pravin B Shelar, Eric Dumazet,
Stephen Hemminger
On Fri, Sep 18, 2015 at 12:59 PM, John W. Linville
<linville@tuxdriver.com> wrote:
> This is primarily for consistancy with vxlan and other tunnels which
> use network byte order for similar parameters.
>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
> It is OK to change this, since this parameter was introduced to
> net-next in the pre-4.3 cycle. Using network byte order for this
> parameter is consistent with what the other tunnels are doing.
Reviewed-by: Jesse Gross <jesse@nicira.com>
Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] geneve: use network byte order for destination port config parameter
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
2015-09-18 20:14 ` Jesse Gross
@ 2015-09-21 23:24 ` David Miller
2015-09-22 15:25 ` John W. Linville
1 sibling, 1 reply; 12+ messages in thread
From: David Miller @ 2015-09-21 23:24 UTC (permalink / raw)
To: linville; +Cc: netdev, pshelar, eric.dumazet, jesse, stephen
From: "John W. Linville" <linville@tuxdriver.com>
Date: Fri, 18 Sep 2015 15:59:10 -0400
> This is primarily for consistancy with vxlan and other tunnels which
> use network byte order for similar parameters.
>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This doesn't apply to any of my trees. Can you respin it against
'net'? Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] geneve: use network byte order for destination port config parameter
2015-09-21 23:24 ` David Miller
@ 2015-09-22 15:25 ` John W. Linville
2015-09-22 17:09 ` [PATCH v2] " John W. Linville
0 siblings, 1 reply; 12+ messages in thread
From: John W. Linville @ 2015-09-22 15:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, pshelar, eric.dumazet, jesse, stephen
On Mon, Sep 21, 2015 at 04:24:04PM -0700, David Miller wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
> Date: Fri, 18 Sep 2015 15:59:10 -0400
>
> > This is primarily for consistancy with vxlan and other tunnels which
> > use network byte order for similar parameters.
> >
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
>
> This doesn't apply to any of my trees. Can you respin it against
> 'net'? Thanks.
Sure -- sorry about that!
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] geneve: use network byte order for destination port config parameter
2015-09-22 15:25 ` John W. Linville
@ 2015-09-22 17:09 ` John W. Linville
2015-09-23 22:41 ` David Miller
0 siblings, 1 reply; 12+ messages in thread
From: John W. Linville @ 2015-09-22 17:09 UTC (permalink / raw)
To: netdev
Cc: davem, Pravin B Shelar, Jesse Gross, Eric Dumazet,
Stephen Hemminger, John W. Linville
This is primarily for consistancy with vxlan and other tunnels which
use network byte order for similar parameters.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
It is OK to change this, since this parameter was introduced to
net-next in the pre-4.3 cycle. Using network byte order for this
parameter is consistent with what the other tunnels are doing.
v2 -- rebase on current net tree...
drivers/net/geneve.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 8f1e9150341a..a955d10986b9 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -815,7 +815,7 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn,
static int geneve_configure(struct net *net, struct net_device *dev,
__be32 rem_addr, __u32 vni, __u8 ttl, __u8 tos,
- __u16 dst_port, bool metadata)
+ __be16 dst_port, bool metadata)
{
struct geneve_net *gn = net_generic(net, geneve_net_id);
struct geneve_dev *t, *geneve = netdev_priv(dev);
@@ -840,10 +840,10 @@ static int geneve_configure(struct net *net, struct net_device *dev,
geneve->ttl = ttl;
geneve->tos = tos;
- geneve->dst_port = htons(dst_port);
+ geneve->dst_port = dst_port;
geneve->collect_md = metadata;
- t = geneve_find_dev(gn, htons(dst_port), rem_addr, geneve->vni,
+ t = geneve_find_dev(gn, dst_port, rem_addr, geneve->vni,
&tun_on_same_port, &tun_collect_md);
if (t)
return -EBUSY;
@@ -867,7 +867,7 @@ static int geneve_configure(struct net *net, struct net_device *dev,
static int geneve_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
- __u16 dst_port = GENEVE_UDP_PORT;
+ __be16 dst_port = htons(GENEVE_UDP_PORT);
__u8 ttl = 0, tos = 0;
bool metadata = false;
__be32 rem_addr;
@@ -886,7 +886,7 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
tos = nla_get_u8(data[IFLA_GENEVE_TOS]);
if (data[IFLA_GENEVE_PORT])
- dst_port = nla_get_u16(data[IFLA_GENEVE_PORT]);
+ dst_port = nla_get_be16(data[IFLA_GENEVE_PORT]);
if (data[IFLA_GENEVE_COLLECT_METADATA])
metadata = true;
@@ -909,7 +909,7 @@ static size_t geneve_get_size(const struct net_device *dev)
nla_total_size(sizeof(struct in_addr)) + /* IFLA_GENEVE_REMOTE */
nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TTL */
nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TOS */
- nla_total_size(sizeof(__u16)) + /* IFLA_GENEVE_PORT */
+ nla_total_size(sizeof(__be16)) + /* IFLA_GENEVE_PORT */
nla_total_size(0) + /* IFLA_GENEVE_COLLECT_METADATA */
0;
}
@@ -931,7 +931,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
nla_put_u8(skb, IFLA_GENEVE_TOS, geneve->tos))
goto nla_put_failure;
- if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
+ if (nla_put_be16(skb, IFLA_GENEVE_PORT, geneve->dst_port))
goto nla_put_failure;
if (geneve->collect_md) {
@@ -971,7 +971,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
if (IS_ERR(dev))
return dev;
- err = geneve_configure(net, dev, 0, 0, 0, 0, dst_port, true);
+ err = geneve_configure(net, dev, 0, 0, 0, 0, htons(dst_port), true);
if (err) {
free_netdev(dev);
return ERR_PTR(err);
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2] geneve: use network byte order for destination port config parameter
2015-09-22 17:09 ` [PATCH v2] " John W. Linville
@ 2015-09-23 22:41 ` David Miller
0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2015-09-23 22:41 UTC (permalink / raw)
To: linville; +Cc: netdev, pshelar, jesse, eric.dumazet, stephen
From: "John W. Linville" <linville@tuxdriver.com>
Date: Tue, 22 Sep 2015 13:09:32 -0400
> This is primarily for consistancy with vxlan and other tunnels which
> use network byte order for similar parameters.
>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
> It is OK to change this, since this parameter was introduced to
> net-next in the pre-4.3 cycle. Using network byte order for this
> parameter is consistent with what the other tunnels are doing.
>
> v2 -- rebase on current net tree...
Applied, thanks John.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-09-23 22:41 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 19:27 [PATCH] iplink_geneve: add UDP destination port configuration at link creation John W. Linville
2015-09-17 20:49 ` Eric Dumazet
2015-09-18 14:26 ` John W. Linville
2015-09-18 14:45 ` Eric Dumazet
2015-09-18 16:15 ` Jesse Gross
2015-09-18 18:39 ` John W. Linville
2015-09-18 19:59 ` [PATCH] geneve: use network byte order for destination port config parameter John W. Linville
2015-09-18 20:14 ` Jesse Gross
2015-09-21 23:24 ` David Miller
2015-09-22 15:25 ` John W. Linville
2015-09-22 17:09 ` [PATCH v2] " John W. Linville
2015-09-23 22:41 ` David Miller
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).