summaryrefslogtreecommitdiffstats
path: root/include/net/rtnetlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/rtnetlink.h')
-rw-r--r--include/net/rtnetlink.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index dce7072bd28..086fa9e8950 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -15,4 +15,12 @@ extern int rtnl_unregister(int protocol, int msgtype);
extern void rtnl_unregister_all(int protocol);
extern int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb);
+static inline int rtnl_msg_family(struct nlmsghdr *nlh)
+{
+ if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
+ return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
+ else
+ return AF_UNSPEC;
+}
+
#endif