diff options
Diffstat (limited to 'net/ipv4/fib_semantics.c')
| -rw-r--r-- | net/ipv4/fib_semantics.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 5f87533684d5..9be53a8e72c3 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
| @@ -709,11 +709,10 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta, | |||
| 709 | goto failure; | 709 | goto failure; |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 712 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
| 713 | if (fi == NULL) | 713 | if (fi == NULL) |
| 714 | goto failure; | 714 | goto failure; |
| 715 | fib_info_cnt++; | 715 | fib_info_cnt++; |
| 716 | memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct fib_nh)); | ||
| 717 | 716 | ||
| 718 | fi->fib_protocol = r->rtm_protocol; | 717 | fi->fib_protocol = r->rtm_protocol; |
| 719 | 718 | ||
| @@ -962,10 +961,6 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
| 962 | rtm->rtm_protocol = fi->fib_protocol; | 961 | rtm->rtm_protocol = fi->fib_protocol; |
| 963 | if (fi->fib_priority) | 962 | if (fi->fib_priority) |
| 964 | RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); | 963 | RTA_PUT(skb, RTA_PRIORITY, 4, &fi->fib_priority); |
| 965 | #ifdef CONFIG_NET_CLS_ROUTE | ||
| 966 | if (fi->fib_nh[0].nh_tclassid) | ||
| 967 | RTA_PUT(skb, RTA_FLOW, 4, &fi->fib_nh[0].nh_tclassid); | ||
| 968 | #endif | ||
| 969 | if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) | 964 | if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0) |
| 970 | goto rtattr_failure; | 965 | goto rtattr_failure; |
| 971 | if (fi->fib_prefsrc) | 966 | if (fi->fib_prefsrc) |
| @@ -975,6 +970,10 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
| 975 | RTA_PUT(skb, RTA_GATEWAY, 4, &fi->fib_nh->nh_gw); | 970 | RTA_PUT(skb, RTA_GATEWAY, 4, &fi->fib_nh->nh_gw); |
| 976 | if (fi->fib_nh->nh_oif) | 971 | if (fi->fib_nh->nh_oif) |
| 977 | RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); | 972 | RTA_PUT(skb, RTA_OIF, sizeof(int), &fi->fib_nh->nh_oif); |
| 973 | #ifdef CONFIG_NET_CLS_ROUTE | ||
| 974 | if (fi->fib_nh[0].nh_tclassid) | ||
| 975 | RTA_PUT(skb, RTA_FLOW, 4, &fi->fib_nh[0].nh_tclassid); | ||
| 976 | #endif | ||
| 978 | } | 977 | } |
| 979 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 978 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
| 980 | if (fi->fib_nhs > 1) { | 979 | if (fi->fib_nhs > 1) { |
| @@ -993,6 +992,10 @@ fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
| 993 | nhp->rtnh_ifindex = nh->nh_oif; | 992 | nhp->rtnh_ifindex = nh->nh_oif; |
| 994 | if (nh->nh_gw) | 993 | if (nh->nh_gw) |
| 995 | RTA_PUT(skb, RTA_GATEWAY, 4, &nh->nh_gw); | 994 | RTA_PUT(skb, RTA_GATEWAY, 4, &nh->nh_gw); |
| 995 | #ifdef CONFIG_NET_CLS_ROUTE | ||
| 996 | if (nh->nh_tclassid) | ||
| 997 | RTA_PUT(skb, RTA_FLOW, 4, &nh->nh_tclassid); | ||
| 998 | #endif | ||
| 996 | nhp->rtnh_len = skb->tail - (unsigned char*)nhp; | 999 | nhp->rtnh_len = skb->tail - (unsigned char*)nhp; |
| 997 | } endfor_nexthops(fi); | 1000 | } endfor_nexthops(fi); |
| 998 | mp_head->rta_type = RTA_MULTIPATH; | 1001 | mp_head->rta_type = RTA_MULTIPATH; |
