diff options
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 2db089e10ba0..0913a090b2bf 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1582,7 +1582,7 @@ failure: | |||
1582 | } | 1582 | } |
1583 | 1583 | ||
1584 | int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, | 1584 | int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, |
1585 | unsigned char *flags, bool skip_oif) | 1585 | u8 rt_family, unsigned char *flags, bool skip_oif) |
1586 | { | 1586 | { |
1587 | if (nhc->nhc_flags & RTNH_F_DEAD) | 1587 | if (nhc->nhc_flags & RTNH_F_DEAD) |
1588 | *flags |= RTNH_F_DEAD; | 1588 | *flags |= RTNH_F_DEAD; |
@@ -1613,7 +1613,7 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc, | |||
1613 | /* if gateway family does not match nexthop family | 1613 | /* if gateway family does not match nexthop family |
1614 | * gateway is encoded as RTA_VIA | 1614 | * gateway is encoded as RTA_VIA |
1615 | */ | 1615 | */ |
1616 | if (nhc->nhc_gw_family != nhc->nhc_family) { | 1616 | if (rt_family != nhc->nhc_gw_family) { |
1617 | int alen = sizeof(struct in6_addr); | 1617 | int alen = sizeof(struct in6_addr); |
1618 | struct nlattr *nla; | 1618 | struct nlattr *nla; |
1619 | struct rtvia *via; | 1619 | struct rtvia *via; |
@@ -1654,7 +1654,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info); | |||
1654 | 1654 | ||
1655 | #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6) | 1655 | #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6) |
1656 | int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, | 1656 | int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, |
1657 | int nh_weight) | 1657 | int nh_weight, u8 rt_family) |
1658 | { | 1658 | { |
1659 | const struct net_device *dev = nhc->nhc_dev; | 1659 | const struct net_device *dev = nhc->nhc_dev; |
1660 | struct rtnexthop *rtnh; | 1660 | struct rtnexthop *rtnh; |
@@ -1667,7 +1667,7 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, | |||
1667 | rtnh->rtnh_hops = nh_weight - 1; | 1667 | rtnh->rtnh_hops = nh_weight - 1; |
1668 | rtnh->rtnh_ifindex = dev ? dev->ifindex : 0; | 1668 | rtnh->rtnh_ifindex = dev ? dev->ifindex : 0; |
1669 | 1669 | ||
1670 | if (fib_nexthop_info(skb, nhc, &flags, true) < 0) | 1670 | if (fib_nexthop_info(skb, nhc, rt_family, &flags, true) < 0) |
1671 | goto nla_put_failure; | 1671 | goto nla_put_failure; |
1672 | 1672 | ||
1673 | rtnh->rtnh_flags = flags; | 1673 | rtnh->rtnh_flags = flags; |
@@ -1693,13 +1693,14 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi) | |||
1693 | goto nla_put_failure; | 1693 | goto nla_put_failure; |
1694 | 1694 | ||
1695 | if (unlikely(fi->nh)) { | 1695 | if (unlikely(fi->nh)) { |
1696 | if (nexthop_mpath_fill_node(skb, fi->nh) < 0) | 1696 | if (nexthop_mpath_fill_node(skb, fi->nh, AF_INET) < 0) |
1697 | goto nla_put_failure; | 1697 | goto nla_put_failure; |
1698 | goto mp_end; | 1698 | goto mp_end; |
1699 | } | 1699 | } |
1700 | 1700 | ||
1701 | for_nexthops(fi) { | 1701 | for_nexthops(fi) { |
1702 | if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight) < 0) | 1702 | if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, |
1703 | AF_INET) < 0) | ||
1703 | goto nla_put_failure; | 1704 | goto nla_put_failure; |
1704 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1705 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1705 | if (nh->nh_tclassid && | 1706 | if (nh->nh_tclassid && |
@@ -1775,7 +1776,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1775 | const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); | 1776 | const struct fib_nh_common *nhc = fib_info_nhc(fi, 0); |
1776 | unsigned char flags = 0; | 1777 | unsigned char flags = 0; |
1777 | 1778 | ||
1778 | if (fib_nexthop_info(skb, nhc, &flags, false) < 0) | 1779 | if (fib_nexthop_info(skb, nhc, AF_INET, &flags, false) < 0) |
1779 | goto nla_put_failure; | 1780 | goto nla_put_failure; |
1780 | 1781 | ||
1781 | rtm->rtm_flags = flags; | 1782 | rtm->rtm_flags = flags; |