diff options
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 5063fa38ac7b..a8bdf7405433 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -931,33 +931,36 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
931 | rtm->rtm_table = tb_id; | 931 | rtm->rtm_table = tb_id; |
932 | else | 932 | else |
933 | rtm->rtm_table = RT_TABLE_COMPAT; | 933 | rtm->rtm_table = RT_TABLE_COMPAT; |
934 | NLA_PUT_U32(skb, RTA_TABLE, tb_id); | 934 | if (nla_put_u32(skb, RTA_TABLE, tb_id)) |
935 | goto nla_put_failure; | ||
935 | rtm->rtm_type = type; | 936 | rtm->rtm_type = type; |
936 | rtm->rtm_flags = fi->fib_flags; | 937 | rtm->rtm_flags = fi->fib_flags; |
937 | rtm->rtm_scope = fi->fib_scope; | 938 | rtm->rtm_scope = fi->fib_scope; |
938 | rtm->rtm_protocol = fi->fib_protocol; | 939 | rtm->rtm_protocol = fi->fib_protocol; |
939 | 940 | ||
940 | if (rtm->rtm_dst_len) | 941 | if (rtm->rtm_dst_len && |
941 | NLA_PUT_BE32(skb, RTA_DST, dst); | 942 | nla_put_be32(skb, RTA_DST, dst)) |
942 | 943 | goto nla_put_failure; | |
943 | if (fi->fib_priority) | 944 | if (fi->fib_priority && |
944 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); | 945 | nla_put_u32(skb, RTA_PRIORITY, fi->fib_priority)) |
945 | 946 | goto nla_put_failure; | |
946 | if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) | 947 | if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) |
947 | goto nla_put_failure; | 948 | goto nla_put_failure; |
948 | 949 | ||
949 | if (fi->fib_prefsrc) | 950 | if (fi->fib_prefsrc && |
950 | NLA_PUT_BE32(skb, RTA_PREFSRC, fi->fib_prefsrc); | 951 | nla_put_be32(skb, RTA_PREFSRC, fi->fib_prefsrc)) |
951 | 952 | goto nla_put_failure; | |
952 | if (fi->fib_nhs == 1) { | 953 | if (fi->fib_nhs == 1) { |
953 | if (fi->fib_nh->nh_gw) | 954 | if (fi->fib_nh->nh_gw && |
954 | NLA_PUT_BE32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); | 955 | nla_put_be32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) |
955 | 956 | goto nla_put_failure; | |
956 | if (fi->fib_nh->nh_oif) | 957 | if (fi->fib_nh->nh_oif && |
957 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); | 958 | nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) |
959 | goto nla_put_failure; | ||
958 | #ifdef CONFIG_IP_ROUTE_CLASSID | 960 | #ifdef CONFIG_IP_ROUTE_CLASSID |
959 | if (fi->fib_nh[0].nh_tclassid) | 961 | if (fi->fib_nh[0].nh_tclassid && |
960 | NLA_PUT_U32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid); | 962 | nla_put_u32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid)) |
963 | goto nla_put_failure; | ||
961 | #endif | 964 | #endif |
962 | } | 965 | } |
963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 966 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
@@ -978,11 +981,13 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
978 | rtnh->rtnh_hops = nh->nh_weight - 1; | 981 | rtnh->rtnh_hops = nh->nh_weight - 1; |
979 | rtnh->rtnh_ifindex = nh->nh_oif; | 982 | rtnh->rtnh_ifindex = nh->nh_oif; |
980 | 983 | ||
981 | if (nh->nh_gw) | 984 | if (nh->nh_gw && |
982 | NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw); | 985 | nla_put_be32(skb, RTA_GATEWAY, nh->nh_gw)) |
986 | goto nla_put_failure; | ||
983 | #ifdef CONFIG_IP_ROUTE_CLASSID | 987 | #ifdef CONFIG_IP_ROUTE_CLASSID |
984 | if (nh->nh_tclassid) | 988 | if (nh->nh_tclassid && |
985 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); | 989 | nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) |
990 | goto nla_put_failure; | ||
986 | #endif | 991 | #endif |
987 | /* length of rtnetlink header + attributes */ | 992 | /* length of rtnetlink header + attributes */ |
988 | rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; | 993 | rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; |