diff options
Diffstat (limited to 'include/linux/netlink.h')
| -rw-r--r-- | include/linux/netlink.h | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index f74dd133788f..f80c56ac4d82 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -153,6 +153,8 @@ struct nlattr { | |||
| 153 | 153 | ||
| 154 | #include <linux/capability.h> | 154 | #include <linux/capability.h> |
| 155 | #include <linux/skbuff.h> | 155 | #include <linux/skbuff.h> |
| 156 | #include <linux/export.h> | ||
| 157 | #include <net/scm.h> | ||
| 156 | 158 | ||
| 157 | struct net; | 159 | struct net; |
| 158 | 160 | ||
| @@ -162,9 +164,10 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) | |||
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | struct netlink_skb_parms { | 166 | struct netlink_skb_parms { |
| 165 | struct ucred creds; /* Skb credentials */ | 167 | struct scm_creds creds; /* Skb credentials */ |
| 166 | __u32 pid; | 168 | __u32 portid; |
| 167 | __u32 dst_group; | 169 | __u32 dst_group; |
| 170 | struct sock *ssk; | ||
| 168 | }; | 171 | }; |
| 169 | 172 | ||
| 170 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) | 173 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) |
| @@ -174,17 +177,27 @@ struct netlink_skb_parms { | |||
| 174 | extern void netlink_table_grab(void); | 177 | extern void netlink_table_grab(void); |
| 175 | extern void netlink_table_ungrab(void); | 178 | extern void netlink_table_ungrab(void); |
| 176 | 179 | ||
| 180 | #define NL_CFG_F_NONROOT_RECV (1 << 0) | ||
| 181 | #define NL_CFG_F_NONROOT_SEND (1 << 1) | ||
| 182 | |||
| 177 | /* optional Netlink kernel configuration parameters */ | 183 | /* optional Netlink kernel configuration parameters */ |
| 178 | struct netlink_kernel_cfg { | 184 | struct netlink_kernel_cfg { |
| 179 | unsigned int groups; | 185 | unsigned int groups; |
| 186 | unsigned int flags; | ||
| 180 | void (*input)(struct sk_buff *skb); | 187 | void (*input)(struct sk_buff *skb); |
| 181 | struct mutex *cb_mutex; | 188 | struct mutex *cb_mutex; |
| 182 | void (*bind)(int group); | 189 | void (*bind)(int group); |
| 183 | }; | 190 | }; |
| 184 | 191 | ||
| 185 | extern struct sock *netlink_kernel_create(struct net *net, int unit, | 192 | extern struct sock *__netlink_kernel_create(struct net *net, int unit, |
| 186 | struct module *module, | 193 | struct module *module, |
| 187 | struct netlink_kernel_cfg *cfg); | 194 | struct netlink_kernel_cfg *cfg); |
| 195 | static inline struct sock * | ||
| 196 | netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg) | ||
| 197 | { | ||
| 198 | return __netlink_kernel_create(net, unit, THIS_MODULE, cfg); | ||
| 199 | } | ||
| 200 | |||
| 188 | extern void netlink_kernel_release(struct sock *sk); | 201 | extern void netlink_kernel_release(struct sock *sk); |
| 189 | extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); | 202 | extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); |
| 190 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); | 203 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); |
| @@ -192,14 +205,14 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group) | |||
| 192 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); | 205 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); |
| 193 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 206 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
| 194 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); | 207 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); |
| 195 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); | 208 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); |
| 196 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, | 209 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, |
| 197 | __u32 group, gfp_t allocation); | 210 | __u32 group, gfp_t allocation); |
| 198 | extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, | 211 | extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, |
| 199 | __u32 pid, __u32 group, gfp_t allocation, | 212 | __u32 portid, __u32 group, gfp_t allocation, |
| 200 | int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), | 213 | int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), |
| 201 | void *filter_data); | 214 | void *filter_data); |
| 202 | extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); | 215 | extern int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code); |
| 203 | extern int netlink_register_notifier(struct notifier_block *nb); | 216 | extern int netlink_register_notifier(struct notifier_block *nb); |
| 204 | extern int netlink_unregister_notifier(struct notifier_block *nb); | 217 | extern int netlink_unregister_notifier(struct notifier_block *nb); |
| 205 | 218 | ||
| @@ -240,12 +253,12 @@ struct netlink_callback { | |||
| 240 | 253 | ||
| 241 | struct netlink_notify { | 254 | struct netlink_notify { |
| 242 | struct net *net; | 255 | struct net *net; |
| 243 | int pid; | 256 | int portid; |
| 244 | int protocol; | 257 | int protocol; |
| 245 | }; | 258 | }; |
| 246 | 259 | ||
| 247 | struct nlmsghdr * | 260 | struct nlmsghdr * |
| 248 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); | 261 | __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags); |
| 249 | 262 | ||
| 250 | struct netlink_dump_control { | 263 | struct netlink_dump_control { |
| 251 | int (*dump)(struct sk_buff *skb, struct netlink_callback *); | 264 | int (*dump)(struct sk_buff *skb, struct netlink_callback *); |
| @@ -258,11 +271,6 @@ extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
| 258 | const struct nlmsghdr *nlh, | 271 | const struct nlmsghdr *nlh, |
| 259 | struct netlink_dump_control *control); | 272 | struct netlink_dump_control *control); |
| 260 | 273 | ||
| 261 | |||
| 262 | #define NL_NONROOT_RECV 0x1 | ||
| 263 | #define NL_NONROOT_SEND 0x2 | ||
| 264 | extern void netlink_set_nonroot(int protocol, unsigned flag); | ||
| 265 | |||
| 266 | #endif /* __KERNEL__ */ | 274 | #endif /* __KERNEL__ */ |
| 267 | 275 | ||
| 268 | #endif /* __LINUX_NETLINK_H */ | 276 | #endif /* __LINUX_NETLINK_H */ |
