diff options
Diffstat (limited to 'net/packet/diag.c')
-rw-r--r-- | net/packet/diag.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/packet/diag.c b/net/packet/diag.c index e3975e4d458c..bc33fbe8a5ef 100644 --- a/net/packet/diag.c +++ b/net/packet/diag.c | |||
@@ -109,6 +109,22 @@ static int pdiag_put_rings_cfg(struct packet_sock *po, struct sk_buff *skb) | |||
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | static int pdiag_put_fanout(struct packet_sock *po, struct sk_buff *nlskb) | ||
113 | { | ||
114 | int ret = 0; | ||
115 | |||
116 | mutex_lock(&fanout_mutex); | ||
117 | if (po->fanout) { | ||
118 | u32 val; | ||
119 | |||
120 | val = (u32)po->fanout->id | ((u32)po->fanout->type << 16); | ||
121 | ret = nla_put_u32(nlskb, PACKET_DIAG_FANOUT, val); | ||
122 | } | ||
123 | mutex_unlock(&fanout_mutex); | ||
124 | |||
125 | return ret; | ||
126 | } | ||
127 | |||
112 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag_req *req, | 128 | static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag_req *req, |
113 | u32 pid, u32 seq, u32 flags, int sk_ino) | 129 | u32 pid, u32 seq, u32 flags, int sk_ino) |
114 | { | 130 | { |
@@ -139,6 +155,10 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag | |||
139 | pdiag_put_rings_cfg(po, skb)) | 155 | pdiag_put_rings_cfg(po, skb)) |
140 | goto out_nlmsg_trim; | 156 | goto out_nlmsg_trim; |
141 | 157 | ||
158 | if ((req->pdiag_show & PACKET_SHOW_FANOUT) && | ||
159 | pdiag_put_fanout(po, skb)) | ||
160 | goto out_nlmsg_trim; | ||
161 | |||
142 | return nlmsg_end(skb, nlh); | 162 | return nlmsg_end(skb, nlh); |
143 | 163 | ||
144 | out_nlmsg_trim: | 164 | out_nlmsg_trim: |