kvm tools, setup: Create private directory
[linux-2.6/next.git] / include / net / nexthop.h
blob3334dbfa5aa4b45ff76338fbd85819e85a7efe8c
1 #ifndef __NET_NEXTHOP_H
2 #define __NET_NEXTHOP_H
4 #include <linux/rtnetlink.h>
5 #include <net/netlink.h>
7 static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
9 return remaining >= sizeof(*rtnh) &&
10 rtnh->rtnh_len >= sizeof(*rtnh) &&
11 rtnh->rtnh_len <= remaining;
14 static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh,
15 int *remaining)
17 int totlen = NLA_ALIGN(rtnh->rtnh_len);
19 *remaining -= totlen;
20 return (struct rtnexthop *) ((char *) rtnh + totlen);
23 static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh)
25 return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh)));
28 static inline int rtnh_attrlen(const struct rtnexthop *rtnh)
30 return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh));
33 #endif