Skip to content

Commit 7822ce7

Browse files
Haishuang Yandavem330
authored andcommitted
netlink: use nla_get_in_addr and nla_put_in_addr for ipv4 address
Since nla_get_in_addr and nla_put_in_addr were implemented, so use them appropriately. Signed-off-by: Haishuang Yan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2349262 commit 7822ce7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ipv4/ip_tunnel_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr,
247247
tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP_ID]);
248248

249249
if (tb[LWTUNNEL_IP_DST])
250-
tun_info->key.u.ipv4.dst = nla_get_be32(tb[LWTUNNEL_IP_DST]);
250+
tun_info->key.u.ipv4.dst = nla_get_in_addr(tb[LWTUNNEL_IP_DST]);
251251

252252
if (tb[LWTUNNEL_IP_SRC])
253-
tun_info->key.u.ipv4.src = nla_get_be32(tb[LWTUNNEL_IP_SRC]);
253+
tun_info->key.u.ipv4.src = nla_get_in_addr(tb[LWTUNNEL_IP_SRC]);
254254

255255
if (tb[LWTUNNEL_IP_TTL])
256256
tun_info->key.ttl = nla_get_u8(tb[LWTUNNEL_IP_TTL]);
@@ -275,8 +275,8 @@ static int ip_tun_fill_encap_info(struct sk_buff *skb,
275275
struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
276276

277277
if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) ||
278-
nla_put_be32(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
279-
nla_put_be32(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
278+
nla_put_in_addr(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
279+
nla_put_in_addr(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
280280
nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) ||
281281
nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) ||
282282
nla_put_be16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags))

0 commit comments

Comments
 (0)