Searched refs:rtnh (Results 1 - 5 of 5) sorted by relevance

/linux-4.4.14/include/net/
H A Dnexthop.h7 static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining) rtnh_ok() argument
9 return remaining >= sizeof(*rtnh) && rtnh_ok()
10 rtnh->rtnh_len >= sizeof(*rtnh) && rtnh_ok()
11 rtnh->rtnh_len <= remaining; rtnh_ok()
14 static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh, rtnh_next() argument
17 int totlen = NLA_ALIGN(rtnh->rtnh_len); rtnh_next()
20 return (struct rtnexthop *) ((char *) rtnh + totlen); rtnh_next()
23 static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh) rtnh_attrs() argument
25 return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh))); rtnh_attrs()
28 static inline int rtnh_attrlen(const struct rtnexthop *rtnh) rtnh_attrlen() argument
30 return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh)); rtnh_attrlen()
/linux-4.4.14/net/ipv4/
H A Dfib_semantics.c457 static int fib_count_nexthops(struct rtnexthop *rtnh, int remaining) fib_count_nexthops() argument
461 while (rtnh_ok(rtnh, remaining)) { fib_count_nexthops()
463 rtnh = rtnh_next(rtnh, &remaining); fib_count_nexthops()
470 static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, fib_get_nhs() argument
479 if (!rtnh_ok(rtnh, remaining)) change_nexthops()
483 (cfg->fc_flags & ~0xFF) | rtnh->rtnh_flags; change_nexthops()
484 nexthop_nh->nh_oif = rtnh->rtnh_ifindex; change_nexthops()
485 nexthop_nh->nh_weight = rtnh->rtnh_hops + 1; change_nexthops()
487 attrlen = rtnh_attrlen(rtnh); change_nexthops()
489 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); change_nexthops()
522 rtnh = rtnh_next(rtnh, &remaining); change_nexthops()
624 struct rtnexthop *rtnh; fib_nh_match() local
648 rtnh = cfg->fc_mp; fib_nh_match()
654 if (!rtnh_ok(rtnh, remaining)) for_nexthops()
657 if (rtnh->rtnh_ifindex && rtnh->rtnh_ifindex != nh->nh_oif) for_nexthops()
660 attrlen = rtnh_attrlen(rtnh); for_nexthops()
662 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); for_nexthops()
674 rtnh = rtnh_next(rtnh, &remaining); for_nexthops()
1279 struct rtnexthop *rtnh; fib_dump_info() local
1289 rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); for_nexthops()
1290 if (!rtnh) for_nexthops()
1293 rtnh->rtnh_flags = nh->nh_flags & 0xFF; for_nexthops()
1298 rtnh->rtnh_flags |= RTNH_F_DEAD; for_nexthops()
1300 rtnh->rtnh_hops = nh->nh_weight - 1; for_nexthops()
1301 rtnh->rtnh_ifindex = nh->nh_oif; for_nexthops()
1314 rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; for_nexthops()
/linux-4.4.14/net/mpls/
H A Daf_mpls.c629 static int mpls_count_nexthops(struct rtnexthop *rtnh, int len, mpls_count_nexthops() argument
635 if (!rtnh) { mpls_count_nexthops()
642 while (rtnh_ok(rtnh, remaining)) { mpls_count_nexthops()
643 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); mpls_count_nexthops()
646 attrlen = rtnh_attrlen(rtnh); mpls_count_nexthops()
659 rtnh = rtnh_next(rtnh, &remaining); mpls_count_nexthops()
669 struct rtnexthop *rtnh = cfg->rc_mp; mpls_nh_build_multi() local
682 if (!rtnh_ok(rtnh, remaining)) change_nexthops()
688 if (rtnh->rtnh_hops || rtnh->rtnh_flags) change_nexthops()
691 attrlen = rtnh_attrlen(rtnh); change_nexthops()
693 struct nlattr *attrs = rtnh_attrs(rtnh); change_nexthops()
700 rtnh->rtnh_ifindex, nla_via, change_nexthops()
705 rtnh = rtnh_next(rtnh, &remaining); change_nexthops()
1259 struct rtnexthop *rtnh; mpls_dump_route() local
1267 rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); for_nexthops()
1268 if (!rtnh) for_nexthops()
1273 rtnh->rtnh_ifindex = dev->ifindex; for_nexthops()
1285 rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh; for_nexthops()
/linux-4.4.14/include/uapi/linux/
H A Drtnetlink.h352 #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
353 ((int)(rtnh)->rtnh_len) <= (len))
354 #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
357 #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
/linux-4.4.14/net/ipv6/
H A Droute.c2830 struct rt6_info *rtnh; ip6_route_info_append() local
2835 rtnh = nh->rt6_info; list_for_each_entry()
2837 if (rtnh->dst.dev == rt->dst.dev && list_for_each_entry()
2838 rtnh->rt6i_idev == rt->rt6i_idev && list_for_each_entry()
2839 ipv6_addr_equal(&rtnh->rt6i_gateway, list_for_each_entry()
2862 struct rtnexthop *rtnh; ip6_route_multipath_add() local
2875 rtnh = (struct rtnexthop *)cfg->fc_mp; ip6_route_multipath_add()
2880 while (rtnh_ok(rtnh, remaining)) { ip6_route_multipath_add()
2882 if (rtnh->rtnh_ifindex) ip6_route_multipath_add()
2883 r_cfg.fc_ifindex = rtnh->rtnh_ifindex; ip6_route_multipath_add()
2885 attrlen = rtnh_attrlen(rtnh); ip6_route_multipath_add()
2887 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); ip6_route_multipath_add()
2913 rtnh = rtnh_next(rtnh, &remaining); ip6_route_multipath_add()
2965 struct rtnexthop *rtnh; ip6_route_multipath_del() local
2971 rtnh = (struct rtnexthop *)cfg->fc_mp; ip6_route_multipath_del()
2974 while (rtnh_ok(rtnh, remaining)) { ip6_route_multipath_del()
2976 if (rtnh->rtnh_ifindex) ip6_route_multipath_del()
2977 r_cfg.fc_ifindex = rtnh->rtnh_ifindex; ip6_route_multipath_del()
2979 attrlen = rtnh_attrlen(rtnh); ip6_route_multipath_del()
2981 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); ip6_route_multipath_del()
2993 rtnh = rtnh_next(rtnh, &remaining); ip6_route_multipath_del()

Completed in 124 milliseconds