/include/net/nexthop.h
https://bitbucket.org/thekraven/iscream_thunderc-2.6.35 · C++ Header · 33 lines · 26 code · 7 blank · 0 comment · 0 complexity · 2b550bc47806360a7b030e3e6f61a5f1 MD5 · raw file
- #ifndef __NET_NEXTHOP_H
- #define __NET_NEXTHOP_H
- #include <linux/rtnetlink.h>
- #include <net/netlink.h>
- static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
- {
- return remaining >= sizeof(*rtnh) &&
- rtnh->rtnh_len >= sizeof(*rtnh) &&
- rtnh->rtnh_len <= remaining;
- }
- static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh,
- int *remaining)
- {
- int totlen = NLA_ALIGN(rtnh->rtnh_len);
- *remaining -= totlen;
- return (struct rtnexthop *) ((char *) rtnh + totlen);
- }
- static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh)
- {
- return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh)));
- }
- static inline int rtnh_attrlen(const struct rtnexthop *rtnh)
- {
- return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh));
- }
- #endif