diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-08-15 03:31:41 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:54:50 -0400 |
commit | 97676b6b5538b3e059d33b8338e7d5cc41c5f1f1 (patch) | |
tree | 76e41eb58bd86a96e204dacbb6746da387e67452 /include | |
parent | d387f6ad10764fc2174373b4a1cca443adee36e3 (diff) |
[RTNETLINK]: Add rtnetlink notification interface
Adds rtnl_notify() to send rtnetlink notification messages and
rtnl_set_sk_err() to report notification errors as socket
errors in order to indicate the need of a resync due to loss
of events.
nlmsg_report() is added to properly document the meaning of
NLM_F_ECHO.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rtnetlink.h | 3 | ||||
-rw-r--r-- | include/net/netlink.h | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 0e4f478e2cb5..ecbe0349060c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -585,6 +585,9 @@ struct rtnetlink_link | |||
585 | extern struct rtnetlink_link * rtnetlink_links[NPROTO]; | 585 | extern struct rtnetlink_link * rtnetlink_links[NPROTO]; |
586 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); | 586 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); |
587 | extern int rtnl_unicast(struct sk_buff *skb, u32 pid); | 587 | extern int rtnl_unicast(struct sk_buff *skb, u32 pid); |
588 | extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, | ||
589 | struct nlmsghdr *nlh, gfp_t flags); | ||
590 | extern void rtnl_set_sk_err(u32 group, int error); | ||
588 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); | 591 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); |
589 | 592 | ||
590 | extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); | 593 | extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); |
diff --git a/include/net/netlink.h b/include/net/netlink.h index b154b81d9a7a..bf593eb59e1b 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -65,6 +65,9 @@ | |||
65 | * nlmsg_validate() validate netlink message incl. attrs | 65 | * nlmsg_validate() validate netlink message incl. attrs |
66 | * nlmsg_for_each_attr() loop over all attributes | 66 | * nlmsg_for_each_attr() loop over all attributes |
67 | * | 67 | * |
68 | * Misc: | ||
69 | * nlmsg_report() report back to application? | ||
70 | * | ||
68 | * ------------------------------------------------------------------------ | 71 | * ------------------------------------------------------------------------ |
69 | * Attributes Interface | 72 | * Attributes Interface |
70 | * ------------------------------------------------------------------------ | 73 | * ------------------------------------------------------------------------ |
@@ -194,6 +197,9 @@ extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | |||
194 | struct nlmsghdr *, int *)); | 197 | struct nlmsghdr *, int *)); |
195 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | 198 | extern void netlink_queue_skip(struct nlmsghdr *nlh, |
196 | struct sk_buff *skb); | 199 | struct sk_buff *skb); |
200 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | ||
201 | u32 pid, unsigned int group, int report, | ||
202 | gfp_t flags); | ||
197 | 203 | ||
198 | extern int nla_validate(struct nlattr *head, int len, int maxtype, | 204 | extern int nla_validate(struct nlattr *head, int len, int maxtype, |
199 | struct nla_policy *policy); | 205 | struct nla_policy *policy); |
@@ -376,6 +382,17 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, | |||
376 | } | 382 | } |
377 | 383 | ||
378 | /** | 384 | /** |
385 | * nlmsg_report - need to report back to application? | ||
386 | * @nlh: netlink message header | ||
387 | * | ||
388 | * Returns 1 if a report back to the application is requested. | ||
389 | */ | ||
390 | static inline int nlmsg_report(struct nlmsghdr *nlh) | ||
391 | { | ||
392 | return !!(nlh->nlmsg_flags & NLM_F_ECHO); | ||
393 | } | ||
394 | |||
395 | /** | ||
379 | * nlmsg_for_each_attr - iterate over a stream of attributes | 396 | * nlmsg_for_each_attr - iterate over a stream of attributes |
380 | * @pos: loop counter, set to current attribute | 397 | * @pos: loop counter, set to current attribute |
381 | * @nlh: netlink message header | 398 | * @nlh: netlink message header |