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

/linux-4.1.27/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.1.27/net/ipv4/
H A Dfib_semantics.c439 static int fib_count_nexthops(struct rtnexthop *rtnh, int remaining) fib_count_nexthops() argument
443 while (rtnh_ok(rtnh, remaining)) { fib_count_nexthops()
445 rtnh = rtnh_next(rtnh, &remaining); fib_count_nexthops()
452 static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, fib_get_nhs() argument
458 if (!rtnh_ok(rtnh, remaining)) change_nexthops()
462 (cfg->fc_flags & ~0xFF) | rtnh->rtnh_flags; change_nexthops()
463 nexthop_nh->nh_oif = rtnh->rtnh_ifindex; change_nexthops()
464 nexthop_nh->nh_weight = rtnh->rtnh_hops + 1; change_nexthops()
466 attrlen = rtnh_attrlen(rtnh); change_nexthops()
468 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); change_nexthops()
480 rtnh = rtnh_next(rtnh, &remaining); change_nexthops()
491 struct rtnexthop *rtnh; fib_nh_match() local
509 rtnh = cfg->fc_mp; fib_nh_match()
515 if (!rtnh_ok(rtnh, remaining)) for_nexthops()
518 if (rtnh->rtnh_ifindex && rtnh->rtnh_ifindex != nh->nh_oif) for_nexthops()
521 attrlen = rtnh_attrlen(rtnh); for_nexthops()
523 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); for_nexthops()
535 rtnh = rtnh_next(rtnh, &remaining); for_nexthops()
1044 struct rtnexthop *rtnh; fib_dump_info() local
1052 rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); for_nexthops()
1053 if (!rtnh) for_nexthops()
1056 rtnh->rtnh_flags = nh->nh_flags & 0xFF; for_nexthops()
1057 rtnh->rtnh_hops = nh->nh_weight - 1; for_nexthops()
1058 rtnh->rtnh_ifindex = nh->nh_oif; for_nexthops()
1069 rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh; for_nexthops()
/linux-4.1.27/include/uapi/linux/
H A Drtnetlink.h346 #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
347 ((int)(rtnh)->rtnh_len) <= (len))
348 #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
351 #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
/linux-4.1.27/net/ipv6/
H A Droute.c2542 struct rt6_info *rtnh; ip6_route_info_append() local
2547 rtnh = nh->rt6_info; list_for_each_entry()
2549 if (rtnh->dst.dev == rt->dst.dev && list_for_each_entry()
2550 rtnh->rt6i_idev == rt->rt6i_idev && list_for_each_entry()
2551 ipv6_addr_equal(&rtnh->rt6i_gateway, list_for_each_entry()
2574 struct rtnexthop *rtnh; ip6_route_multipath_add() local
2587 rtnh = (struct rtnexthop *)cfg->fc_mp; ip6_route_multipath_add()
2592 while (rtnh_ok(rtnh, remaining)) { ip6_route_multipath_add()
2594 if (rtnh->rtnh_ifindex) ip6_route_multipath_add()
2595 r_cfg.fc_ifindex = rtnh->rtnh_ifindex; ip6_route_multipath_add()
2597 attrlen = rtnh_attrlen(rtnh); ip6_route_multipath_add()
2599 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); ip6_route_multipath_add()
2618 rtnh = rtnh_next(rtnh, &remaining); ip6_route_multipath_add()
2671 struct rtnexthop *rtnh; ip6_route_multipath_del() local
2677 rtnh = (struct rtnexthop *)cfg->fc_mp; ip6_route_multipath_del()
2680 while (rtnh_ok(rtnh, remaining)) { ip6_route_multipath_del()
2682 if (rtnh->rtnh_ifindex) ip6_route_multipath_del()
2683 r_cfg.fc_ifindex = rtnh->rtnh_ifindex; ip6_route_multipath_del()
2685 attrlen = rtnh_attrlen(rtnh); ip6_route_multipath_del()
2687 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); ip6_route_multipath_del()
2699 rtnh = rtnh_next(rtnh, &remaining); ip6_route_multipath_del()

Completed in 160 milliseconds