diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-09-27 01:15:25 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-28 20:54:16 -0400 |
commit | 17fb2c64394a2d5106540d69fc83c183ee7c206e (patch) | |
tree | cfc528dd1dde8a711c63b9b05b2e6d2370d5b2ba | |
parent | e448515c79c3785eae225c25e8cd5b90b470d0a6 (diff) |
[IPV4]: RTA_{DST,SRC,GATEWAY,PREFSRC} annotated
these are passed net-endian; use be32 netlink accessors
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/fib_frontend.c | 8 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 12 | ||||
-rw-r--r-- | net/ipv4/route.c | 14 |
3 files changed, 17 insertions, 17 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 684b91f7c2ae..319aaafd3545 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -499,22 +499,22 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { | 499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { |
500 | switch (attr->nla_type) { | 500 | switch (attr->nla_type) { |
501 | case RTA_DST: | 501 | case RTA_DST: |
502 | cfg->fc_dst = nla_get_u32(attr); | 502 | cfg->fc_dst = nla_get_be32(attr); |
503 | break; | 503 | break; |
504 | case RTA_SRC: | 504 | case RTA_SRC: |
505 | cfg->fc_src = nla_get_u32(attr); | 505 | cfg->fc_src = nla_get_be32(attr); |
506 | break; | 506 | break; |
507 | case RTA_OIF: | 507 | case RTA_OIF: |
508 | cfg->fc_oif = nla_get_u32(attr); | 508 | cfg->fc_oif = nla_get_u32(attr); |
509 | break; | 509 | break; |
510 | case RTA_GATEWAY: | 510 | case RTA_GATEWAY: |
511 | cfg->fc_gw = nla_get_u32(attr); | 511 | cfg->fc_gw = nla_get_be32(attr); |
512 | break; | 512 | break; |
513 | case RTA_PRIORITY: | 513 | case RTA_PRIORITY: |
514 | cfg->fc_priority = nla_get_u32(attr); | 514 | cfg->fc_priority = nla_get_u32(attr); |
515 | break; | 515 | break; |
516 | case RTA_PREFSRC: | 516 | case RTA_PREFSRC: |
517 | cfg->fc_prefsrc = nla_get_u32(attr); | 517 | cfg->fc_prefsrc = nla_get_be32(attr); |
518 | break; | 518 | break; |
519 | case RTA_METRICS: | 519 | case RTA_METRICS: |
520 | cfg->fc_mx = nla_data(attr); | 520 | cfg->fc_mx = nla_data(attr); |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 152d9a264fab..d91244782216 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -374,7 +374,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, | |||
374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
375 | 375 | ||
376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
377 | nh->nh_gw = nla ? nla_get_u32(nla) : 0; | 377 | nh->nh_gw = nla ? nla_get_be32(nla) : 0; |
378 | #ifdef CONFIG_NET_CLS_ROUTE | 378 | #ifdef CONFIG_NET_CLS_ROUTE |
379 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 379 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; | 380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; |
@@ -427,7 +427,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) | |||
427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
428 | 428 | ||
429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
430 | if (nla && nla_get_u32(nla) != nh->nh_gw) | 430 | if (nla && nla_get_be32(nla) != nh->nh_gw) |
431 | return 1; | 431 | return 1; |
432 | #ifdef CONFIG_NET_CLS_ROUTE | 432 | #ifdef CONFIG_NET_CLS_ROUTE |
433 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 433 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
@@ -952,7 +952,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
952 | rtm->rtm_protocol = fi->fib_protocol; | 952 | rtm->rtm_protocol = fi->fib_protocol; |
953 | 953 | ||
954 | if (rtm->rtm_dst_len) | 954 | if (rtm->rtm_dst_len) |
955 | NLA_PUT_U32(skb, RTA_DST, dst); | 955 | NLA_PUT_BE32(skb, RTA_DST, dst); |
956 | 956 | ||
957 | if (fi->fib_priority) | 957 | if (fi->fib_priority) |
958 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); | 958 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); |
@@ -961,11 +961,11 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
961 | goto nla_put_failure; | 961 | goto nla_put_failure; |
962 | 962 | ||
963 | if (fi->fib_prefsrc) | 963 | if (fi->fib_prefsrc) |
964 | NLA_PUT_U32(skb, RTA_PREFSRC, fi->fib_prefsrc); | 964 | NLA_PUT_BE32(skb, RTA_PREFSRC, fi->fib_prefsrc); |
965 | 965 | ||
966 | if (fi->fib_nhs == 1) { | 966 | if (fi->fib_nhs == 1) { |
967 | if (fi->fib_nh->nh_gw) | 967 | if (fi->fib_nh->nh_gw) |
968 | NLA_PUT_U32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); | 968 | NLA_PUT_BE32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); |
969 | 969 | ||
970 | if (fi->fib_nh->nh_oif) | 970 | if (fi->fib_nh->nh_oif) |
971 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); | 971 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); |
@@ -993,7 +993,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
993 | rtnh->rtnh_ifindex = nh->nh_oif; | 993 | rtnh->rtnh_ifindex = nh->nh_oif; |
994 | 994 | ||
995 | if (nh->nh_gw) | 995 | if (nh->nh_gw) |
996 | NLA_PUT_U32(skb, RTA_GATEWAY, nh->nh_gw); | 996 | NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw); |
997 | #ifdef CONFIG_NET_CLS_ROUTE | 997 | #ifdef CONFIG_NET_CLS_ROUTE |
998 | if (nh->nh_tclassid) | 998 | if (nh->nh_tclassid) |
999 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); | 999 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c42ed803c3eb..c41ddba02e9d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2661,11 +2661,11 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2661 | if (rt->rt_flags & RTCF_NOTIFY) | 2661 | if (rt->rt_flags & RTCF_NOTIFY) |
2662 | r->rtm_flags |= RTM_F_NOTIFY; | 2662 | r->rtm_flags |= RTM_F_NOTIFY; |
2663 | 2663 | ||
2664 | NLA_PUT_U32(skb, RTA_DST, rt->rt_dst); | 2664 | NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst); |
2665 | 2665 | ||
2666 | if (rt->fl.fl4_src) { | 2666 | if (rt->fl.fl4_src) { |
2667 | r->rtm_src_len = 32; | 2667 | r->rtm_src_len = 32; |
2668 | NLA_PUT_U32(skb, RTA_SRC, rt->fl.fl4_src); | 2668 | NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src); |
2669 | } | 2669 | } |
2670 | if (rt->u.dst.dev) | 2670 | if (rt->u.dst.dev) |
2671 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); | 2671 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); |
@@ -2678,12 +2678,12 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2678 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); | 2678 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); |
2679 | #endif | 2679 | #endif |
2680 | if (rt->fl.iif) | 2680 | if (rt->fl.iif) |
2681 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_spec_dst); | 2681 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst); |
2682 | else if (rt->rt_src != rt->fl.fl4_src) | 2682 | else if (rt->rt_src != rt->fl.fl4_src) |
2683 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_src); | 2683 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src); |
2684 | 2684 | ||
2685 | if (rt->rt_dst != rt->rt_gateway) | 2685 | if (rt->rt_dst != rt->rt_gateway) |
2686 | NLA_PUT_U32(skb, RTA_GATEWAY, rt->rt_gateway); | 2686 | NLA_PUT_BE32(skb, RTA_GATEWAY, rt->rt_gateway); |
2687 | 2687 | ||
2688 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) | 2688 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) |
2689 | goto nla_put_failure; | 2689 | goto nla_put_failure; |
@@ -2768,8 +2768,8 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2768 | skb->nh.iph->protocol = IPPROTO_ICMP; | 2768 | skb->nh.iph->protocol = IPPROTO_ICMP; |
2769 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); | 2769 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); |
2770 | 2770 | ||
2771 | src = tb[RTA_SRC] ? nla_get_u32(tb[RTA_SRC]) : 0; | 2771 | src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; |
2772 | dst = tb[RTA_DST] ? nla_get_u32(tb[RTA_DST]) : 0; | 2772 | dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0; |
2773 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; | 2773 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; |
2774 | 2774 | ||
2775 | if (iif) { | 2775 | if (iif) { |