Skip to content

Commit 59c2805

Browse files
Jakub Kicinskidavem330
authored andcommitted
net: netlink: add helper to retrieve NETLINK_F_STRICT_CHK
Dumps can read state of the NETLINK_F_STRICT_CHK flag from a field in the callback structure. For non-dump GET requests we need a way to access the state of that flag from a socket. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 133bbb1 commit 59c2805

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/linux/netlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
126126
void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
127127
const struct netlink_ext_ack *extack);
128128
int netlink_has_listeners(struct sock *sk, unsigned int group);
129+
bool netlink_strict_get_check(struct sk_buff *skb);
129130

130131
int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
131132
int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,

net/netlink/af_netlink.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,14 @@ int netlink_has_listeners(struct sock *sk, unsigned int group)
13711371
}
13721372
EXPORT_SYMBOL_GPL(netlink_has_listeners);
13731373

1374+
bool netlink_strict_get_check(struct sk_buff *skb)
1375+
{
1376+
const struct netlink_sock *nlk = nlk_sk(NETLINK_CB(skb).sk);
1377+
1378+
return nlk->flags & NETLINK_F_STRICT_CHK;
1379+
}
1380+
EXPORT_SYMBOL_GPL(netlink_strict_get_check);
1381+
13741382
static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
13751383
{
13761384
struct netlink_sock *nlk = nlk_sk(sk);

0 commit comments

Comments
 (0)