From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Tom Herbert <therbert@google.com>, Cong Wang <xiyou.wangcong@gmail.com>
Subject: [Patch net-next 3/5] fou: fix byte order of udp_config.local_udp_port
Date: Mon, 6 Apr 2015 16:41:28 -0700 [thread overview]
Message-ID: <1428363690-16288-4-git-send-email-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <1428363690-16288-1-git-send-email-xiyou.wangcong@gmail.com>
udp_config.local_udp_port is be16. And iproute2 passes
network order for FOU_ATTR_PORT.
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/ipv4/fou.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index ad0ee82..cf606fc 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -468,7 +468,7 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
sk = sock->sk;
fou->flags = cfg->flags;
- fou->port = cfg->udp_config.local_udp_port;
+ fou->port = ntohs(cfg->udp_config.local_udp_port);
/* Initial for fou type */
switch (cfg->type) {
@@ -523,7 +523,7 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
static int fou_destroy(struct net *net, struct fou_cfg *cfg)
{
struct fou *fou;
- u16 port = cfg->udp_config.local_udp_port;
+ u16 port = ntohs(cfg->udp_config.local_udp_port);
int err = -EINVAL;
spin_lock(&fou_lock);
@@ -573,7 +573,7 @@ static int parse_nl_config(struct genl_info *info,
}
if (info->attrs[FOU_ATTR_PORT]) {
- u16 port = nla_get_u16(info->attrs[FOU_ATTR_PORT]);
+ __be16 port = nla_get_be16(info->attrs[FOU_ATTR_PORT]);
cfg->udp_config.local_udp_port = port;
}
--
1.8.3.1
next prev parent reply other threads:[~2015-04-06 23:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-06 23:41 [Patch net-next 0/5] fou: some fixes and updates Cong Wang
2015-04-06 23:41 ` [Patch net-next 1/5] fou: avoid calling udp_del_offload() twice Cong Wang
2015-04-06 23:41 ` [Patch net-next 2/5] fou: exit early when parsing config fails Cong Wang
2015-04-06 23:41 ` Cong Wang [this message]
2015-04-07 6:09 ` [Patch net-next 3/5] fou: fix byte order of udp_config.local_udp_port Tom Herbert
2015-04-07 21:11 ` Cong Wang
2015-04-07 21:47 ` Tom Herbert
2015-04-07 21:57 ` Cong Wang
2015-04-07 22:07 ` Tom Herbert
2015-04-06 23:41 ` [Patch net-next 4/5] fou: add network namespace support Cong Wang
2015-04-06 23:41 ` [Patch net-next 5/5] fou: implement FOU_CMD_GET Cong Wang
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=1428363690-16288-4-git-send-email-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.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).