1 #ifndef __RTNETLINK_WRAPPER_H
2 #define __RTNETLINK_WRAPPER_H 1
4 #include_next <linux/rtnetlink.h>
6 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9 static inline void rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
10 struct nlmsghdr *nlh, gfp_t flags)
12 BUG_ON(nlh); /* not implemented */
14 /* errors reported via destination sk->sk_err */
15 nlmsg_multicast(rtnl, skb, 0, group);
19 static inline void rtnl_set_sk_err(u32 group, int error)
21 netlink_set_err(rtnl, 0, group, error);
25 /* No 'net' parameter in these versions. */
26 #define rtnl_notify(skb, net, pid, group, nlh, flags) \
27 ((void) rtnl_notify(skb, pid, group, nlh, flags))
28 #define rtnl_set_sk_err(net, group, error) \
29 (rtnl_set_sk_err(group, error))
30 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
31 /* Make the return type effectively 'void' to match Linux 2.6.30+. */
32 #define rtnl_notify(skb, net, pid, group, nlh, flags) \
33 ((void) rtnl_notify(skb, net, pid, group, nlh, flags))
36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
37 static inline int rtnl_is_locked(void)
39 if (unlikely(rtnl_trylock())) {
49 #endif /* linux/rtnetlink.h wrapper */