aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-10-10 15:11:06 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-10 15:11:06 -0400
commit4d74f8ba1fb152ae07eb858abb713e094e77b7d5 (patch)
tree83e70fcafaee8fba793573a59f918c37a2f9bf53 /net
parentba9e64b1c23f1dd22fea14c310f739d84ac8b748 (diff)
gre: minor cleanups in netlink interface
- use typeful helpers for IFLA_GRE_LOCAL/IFLA_GRE_REMOTE - replace magic value by FIELD_SIZEOF - use MODULE_ALIAS_RTNL_LINK macro Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_gre.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index c0755e98b810..05ebce2881ef 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1368,10 +1368,10 @@ static void ipgre_netlink_parms(struct nlattr *data[],
1368 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]); 1368 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]);
1369 1369
1370 if (data[IFLA_GRE_LOCAL]) 1370 if (data[IFLA_GRE_LOCAL])
1371 memcpy(&parms->iph.saddr, nla_data(data[IFLA_GRE_LOCAL]), 4); 1371 parms->iph.saddr = nla_get_be32(data[IFLA_GRE_LOCAL]);
1372 1372
1373 if (data[IFLA_GRE_REMOTE]) 1373 if (data[IFLA_GRE_REMOTE])
1374 memcpy(&parms->iph.daddr, nla_data(data[IFLA_GRE_REMOTE]), 4); 1374 parms->iph.daddr = nla_get_be32(data[IFLA_GRE_REMOTE]);
1375 1375
1376 if (data[IFLA_GRE_TTL]) 1376 if (data[IFLA_GRE_TTL])
1377 parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]); 1377 parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]);
@@ -1541,8 +1541,8 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)
1541 NLA_PUT_BE16(skb, IFLA_GRE_OFLAGS, p->o_flags); 1541 NLA_PUT_BE16(skb, IFLA_GRE_OFLAGS, p->o_flags);
1542 NLA_PUT_BE32(skb, IFLA_GRE_IKEY, p->i_key); 1542 NLA_PUT_BE32(skb, IFLA_GRE_IKEY, p->i_key);
1543 NLA_PUT_BE32(skb, IFLA_GRE_OKEY, p->o_key); 1543 NLA_PUT_BE32(skb, IFLA_GRE_OKEY, p->o_key);
1544 NLA_PUT(skb, IFLA_GRE_LOCAL, 4, &p->iph.saddr); 1544 NLA_PUT_BE32(skb, IFLA_GRE_LOCAL, p->iph.saddr);
1545 NLA_PUT(skb, IFLA_GRE_REMOTE, 4, &p->iph.daddr); 1545 NLA_PUT_BE32(skb, IFLA_GRE_REMOTE, p->iph.daddr);
1546 NLA_PUT_U8(skb, IFLA_GRE_TTL, p->iph.ttl); 1546 NLA_PUT_U8(skb, IFLA_GRE_TTL, p->iph.ttl);
1547 NLA_PUT_U8(skb, IFLA_GRE_TOS, p->iph.tos); 1547 NLA_PUT_U8(skb, IFLA_GRE_TOS, p->iph.tos);
1548 NLA_PUT_U8(skb, IFLA_GRE_PMTUDISC, !!(p->iph.frag_off & htons(IP_DF))); 1548 NLA_PUT_U8(skb, IFLA_GRE_PMTUDISC, !!(p->iph.frag_off & htons(IP_DF)));
@@ -1559,8 +1559,8 @@ static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = {
1559 [IFLA_GRE_OFLAGS] = { .type = NLA_U16 }, 1559 [IFLA_GRE_OFLAGS] = { .type = NLA_U16 },
1560 [IFLA_GRE_IKEY] = { .type = NLA_U32 }, 1560 [IFLA_GRE_IKEY] = { .type = NLA_U32 },
1561 [IFLA_GRE_OKEY] = { .type = NLA_U32 }, 1561 [IFLA_GRE_OKEY] = { .type = NLA_U32 },
1562 [IFLA_GRE_LOCAL] = { .len = 4 }, 1562 [IFLA_GRE_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) },
1563 [IFLA_GRE_REMOTE] = { .len = 4 }, 1563 [IFLA_GRE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
1564 [IFLA_GRE_TTL] = { .type = NLA_U8 }, 1564 [IFLA_GRE_TTL] = { .type = NLA_U8 },
1565 [IFLA_GRE_TOS] = { .type = NLA_U8 }, 1565 [IFLA_GRE_TOS] = { .type = NLA_U8 },
1566 [IFLA_GRE_PMTUDISC] = { .type = NLA_U8 }, 1566 [IFLA_GRE_PMTUDISC] = { .type = NLA_U8 },
@@ -1643,5 +1643,5 @@ static void __exit ipgre_fini(void)
1643module_init(ipgre_init); 1643module_init(ipgre_init);
1644module_exit(ipgre_fini); 1644module_exit(ipgre_fini);
1645MODULE_LICENSE("GPL"); 1645MODULE_LICENSE("GPL");
1646MODULE_ALIAS("rtnl-link-gre"); 1646MODULE_ALIAS_RTNL_LINK("gre");
1647MODULE_ALIAS("rtnl-link-gretap"); 1647MODULE_ALIAS_RTNL_LINK("gretap");