* Re: [GIT] Networking
From: Linus Torvalds @ 2014-10-20 0:32 UTC (permalink / raw)
To: David Miller, Pablo Neira Ayuso
Cc: Andrew Morton, Network Development, Linux Kernel Mailing List
In-Reply-To: <20141019.132314.264021750039480460.davem@davemloft.net>
On Sun, Oct 19, 2014 at 10:23 AM, David Miller <davem@davemloft.net> wrote:
>
> A quick batch of bug fixes:
Ho humm.. Here's another networking issue with the current kernel:
nf_reject_ipv6: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
nf_reject_ipv6: Unknown symbol ip6_local_out (err 0)
Hmm? I'm not sure this is new, but I hadn't noticed it before. The
"unknown symbol" seems to be simply because ip6_local_out is GPL-only,
and without a proper license, 'nf_reject_ipv6' not only taints the
kernel but doesn't link properly..
Looks like the module license issue was just overlooked when moving
the code out in commit c8d7b98bec43 ("netfilter: move nf_send_resetX()
code to nf_reject_ipvX modules").
Linus
^ permalink raw reply
* Re: [PATCH 0/3] net: minor gso encapsulation fixes
From: Florian Westphal @ 2014-10-19 20:55 UTC (permalink / raw)
To: netdev
In-Reply-To: <1413751340-19621-1-git-send-email-fw@strlen.de>
Florian Westphal <fw@strlen.de> wrote:
> The following series fixes a minor bug in the gro segmentation handlers
> when handling encapsulation offloads.
In case you're wondering, 'is there a 4th patch in this series'?
There was, I intentionally did not send it (IMO its -next material)
but forgot to adjust the "PATCH x/y" part of the subject lines.
^ permalink raw reply
* [PATCH 3/4] net: core: handle encapsulation offloads when computing segment lengths
From: Florian Westphal @ 2014-10-19 20:42 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Westphal
In-Reply-To: <1413751340-19621-1-git-send-email-fw@strlen.de>
if ->encapsulation is set we have to use inner_tcp_hdrlen and add the
size of the inner network headers too.
This is 'mostly harmless'; tbf might send skb that is slightly over
quota or drop skb even if it would have fit.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/core/skbuff.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7b3df0d..eb4b48b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4059,15 +4059,22 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet);
unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
{
const struct skb_shared_info *shinfo = skb_shinfo(skb);
+ unsigned int thlen = 0;
- if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
- return tcp_hdrlen(skb) + shinfo->gso_size;
+ if (skb->encapsulation) {
+ thlen = skb_inner_transport_header(skb) -
+ skb_transport_header(skb);
+ if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
+ thlen += inner_tcp_hdrlen(skb);
+ } else if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
+ thlen = tcp_hdrlen(skb);
+ }
/* UFO sets gso_size to the size of the fragmentation
* payload, i.e. the size of the L4 (UDP) header is already
* accounted for.
*/
- return shinfo->gso_size;
+ return thlen + shinfo->gso_size;
}
EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
--
2.0.4
^ permalink raw reply related
* [PATCH 2/4] net: make skb_gso_segment error handling more robust
From: Florian Westphal @ 2014-10-19 20:42 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Westphal
In-Reply-To: <1413751340-19621-1-git-send-email-fw@strlen.de>
skb_gso_segment has three possible return values:
1. a pointer to the first segmented skb
2. an errno value (IS_ERR())
3. NULL. This can happen when GSO is used for header verification.
However, several callers currently test IS_ERR instead of IS_ERR_OR_NULL
and would oops when NULL is returned.
Note that these call sites should never actually see such a NULL return
value; all callers mask out the GSO bits in the feature argument.
However, in the past, there have been issues with some protocol handlers
erronously not respecting the specified feature mask in some cases.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv4/ip_output.c | 2 +-
net/netfilter/nfnetlink_queue_core.c | 2 +-
net/openvswitch/datapath.c | 2 +-
net/xfrm/xfrm_output.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e35b712..88a0ee3 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -231,7 +231,7 @@ static int ip_finish_output_gso(struct sk_buff *skb)
*/
features = netif_skb_features(skb);
segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
- if (IS_ERR(segs)) {
+ if (IS_ERR_OR_NULL(segs)) {
kfree_skb(skb);
return -ENOMEM;
}
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index a82077d..7c60ccd 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -665,7 +665,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
* returned by nf_queue. For instance, callers rely on -ECANCELED to
* mean 'ignore this hook'.
*/
- if (IS_ERR(segs))
+ if (IS_ERR_OR_NULL(segs))
goto out_err;
queued = 0;
err = 0;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 2e31d9e..f98f708 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -322,7 +322,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
int err;
segs = __skb_gso_segment(skb, NETIF_F_SG, false);
- if (IS_ERR(segs))
+ if (IS_ERR_OR_NULL(segs))
return PTR_ERR(segs);
/* Queue all of the segments. */
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 499d6c1..eef4334 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -155,7 +155,7 @@ static int xfrm_output_gso(struct sk_buff *skb)
segs = skb_gso_segment(skb, 0);
kfree_skb(skb);
- if (IS_ERR(segs))
+ if (IS_ERR_OR_NULL(segs))
return PTR_ERR(segs);
do {
--
2.0.4
^ permalink raw reply related
* [PATCH 1/4] net: gso: use feature flag argument in all protocol gso handlers
From: Florian Westphal @ 2014-10-19 20:42 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Westphal, Pravin B Shelar
In-Reply-To: <1413751340-19621-1-git-send-email-fw@strlen.de>
skb_gso_segment() has a 'features' argument representing offload features
available to the output path.
A few handlers, e.g. GRE, instead re-fetch the features of skb->dev and use
those instead of the provided ones when handing encapsulation/tunnels.
Depending on dev->hw_enc_features of the output device skb_gso_segment() can
then return NULL even when the caller has disabled all GSO feature bits,
as segmentation of inner header thinks device will take care of segmentation.
This e.g. affects the tbf scheduler, which will silently drop GRE-encap GSO skbs
that did not fit the remaining token quota as the segmentation does not work
when device supports corresponding hw offload capabilities.
Cc: Eric Dumazet <edumazet@google.com>
Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv4/af_inet.c | 2 +-
net/ipv4/gre_offload.c | 2 +-
net/ipv4/udp_offload.c | 2 +-
net/ipv6/ip6_offload.c | 2 +-
net/mpls/mpls_gso.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 92db7a6..8b7fe5b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1246,7 +1246,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0;
if (encap)
- features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ features &= skb->dev->hw_enc_features;
SKB_GSO_CB(skb)->encap_level += ihl;
skb_reset_transport_header(skb);
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index a777295..e084534 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -68,7 +68,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
skb->mac_len = skb_inner_network_offset(skb);
/* segment inner packet. */
- enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ enc_features = skb->dev->hw_enc_features & features;
segs = skb_mac_gso_segment(skb, enc_features);
if (IS_ERR_OR_NULL(segs)) {
skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len);
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 507310e..6480cea 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -58,7 +58,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
/* segment inner packet. */
- enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ enc_features = skb->dev->hw_enc_features & features;
segs = gso_inner_segment(skb, enc_features);
if (IS_ERR_OR_NULL(segs)) {
skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset,
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 9034f76..820cdb1 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -89,7 +89,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0;
if (encap)
- features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ features &= skb->dev->hw_enc_features;
SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h);
ipv6h = ipv6_hdr(skb);
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index e28ed2e..f0f5309 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -48,7 +48,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
__skb_push(skb, skb->mac_len);
/* Segment inner packet. */
- mpls_features = skb->dev->mpls_features & netif_skb_features(skb);
+ mpls_features = skb->dev->mpls_features & features;
segs = skb_mac_gso_segment(skb, mpls_features);
--
2.0.4
^ permalink raw reply related
* [PATCH 0/3] net: minor gso encapsulation fixes
From: Florian Westphal @ 2014-10-19 20:42 UTC (permalink / raw)
To: netdev; +Cc: edumazet
The following series fixes a minor bug in the gro segmentation handlers
when handling encapsulation offloads.
Theoretically this could cause kernel panic when the stack tries
to software-segment such a GRE offload packet, but it looks like there
is only one affected call site (tbf scheduler) and it handles NULL
return value.
I've included a followup patch to add IS_ERR_OR_NULL checks to all
the various skb_gso_segment call sites.
While looking into this, I also found that size computation of the individual
segments is incorrect as we do not consider skb->encapsulation.
core/skbuff.c | 13 ++++++++++---
ipv4/af_inet.c | 2 +-
ipv4/gre_offload.c | 2 +-
ipv4/ip_output.c | 2 +-
ipv4/udp_offload.c | 2 +-
ipv6/ip6_offload.c | 2 +-
mpls/mpls_gso.c | 2 +-
netfilter/nfnetlink_queue_core.c | 2 +-
openvswitch/datapath.c | 2 +-
xfrm/xfrm_output.c | 2 +-
10 files changed, 19 insertions(+), 12 deletions(-)
^ permalink raw reply
* qdisc running
From: Jamal Hadi Salim @ 2014-10-19 19:24 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: john Fastabend, Herbert Xu, netdev@vger.kernel.org, eric Dumazet
Jesper,
You asked at the meeting the point to qdisc running.
Original intent is to allow only one cpu to enter the lower half of the
qdisc path. IOW, if one cpu was already in the qdisc then that guy
could be used to dequeue packets. i.e this is good for batching.
Original idea was Herbert's with major improvement from Eric
and a small one from me.
For history of different tried approaches look at:
Look at slide 2:
http://vger.kernel.org/netconf2011_slides/jamal_netconf2011.pdf
then download the **amazing** flash animations which describe
that history.
http://vger.kernel.org/netconf2011_slides/netconf-2011-flash.tgz
Follow the bullets in slide2 and map to the flash animations.
If you go over them, you'll see it is still needed.
I think someone oughta put those **amazing** animations on some
website;->
cheers,
jamal
^ permalink raw reply
* Re: [PATCH] ipv6: tcp_v6_iff: fix compilation error on CONFIG_IPV6=n
From: Eric Dumazet @ 2014-10-19 18:50 UTC (permalink / raw)
To: Manfred Schlaegl; +Cc: David S. Miller, netdev, linux-kernel, Manfred Schlaegl
In-Reply-To: <5443FD47.7040003@gmx.at>
On Sun, 2014-10-19 at 20:04 +0200, Manfred Schlaegl wrote:
> If CONFIG_IPV6=n, then h6 in struct tcp_skb_cb.header is missing which
> leads to compilation-errors on tcp_v6_iff like:
>
> In file included from net/core/sock.c:140:0:
> include/net/tcp.h: In function ‘tcp_v6_iif’:
> include/net/tcp.h:738:32: error: ‘union <anonymous>’ has no member named
> ‘h6’
>
> This fix solves the problem by removing tcp_v6_iif, in case of
> CONFIG_IPV6=n.
>
> Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
> ---
Yes, this was fixed yesterday, thanks.
http://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=815afe1785da727ee48cd8e63ac4a3ec6c7459b3
^ permalink raw reply
* [PATCH] ipv6: tcp_v6_iff: fix compilation error on CONFIG_IPV6=n
From: Manfred Schlaegl @ 2014-10-19 18:04 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel, Manfred Schlaegl
If CONFIG_IPV6=n, then h6 in struct tcp_skb_cb.header is missing which
leads to compilation-errors on tcp_v6_iff like:
In file included from net/core/sock.c:140:0:
include/net/tcp.h: In function ‘tcp_v6_iif’:
include/net/tcp.h:738:32: error: ‘union <anonymous>’ has no member named
‘h6’
This fix solves the problem by removing tcp_v6_iif, in case of
CONFIG_IPV6=n.
Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
---
include/net/tcp.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index c9766f8..4062b4f 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -730,6 +730,7 @@ struct tcp_skb_cb {
#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
+#if IS_ENABLED(CONFIG_IPV6)
/* This is the variant of inet6_iif() that must be used by TCP,
* as TCP moves IP6CB into a different location in skb->cb[]
*/
@@ -737,6 +738,7 @@ static inline int tcp_v6_iif(const struct sk_buff *skb)
{
return TCP_SKB_CB(skb)->header.h6.iif;
}
+#endif
/* Due to TSO, an SKB can be composed of multiple actual
* packets. To keep these tracked properly, we use this.
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] net: s6gmac: remove driver
From: David Miller @ 2014-10-19 17:28 UTC (permalink / raw)
To: jcmvbkbc; +Cc: dg, netdev, linux-kernel
In-Reply-To: <CAMo8BfJ-wvDoDmm+HLHvC3VRUshdqU4eJchOGYt_YJsUktap8Q@mail.gmail.com>
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 19 Oct 2014 21:26:05 +0400
> On Sun, Oct 19, 2014 at 8:45 PM, David Miller <davem@davemloft.net> wrote:
>> From: Daniel Glöckner <dg@emlix.com>
>> Date: Sun, 19 Oct 2014 00:49:05 +0200
>>
>>> The s6000 Xtensa support is removed from the kernel. There are no
>>> other chips using this driver.
>>
>> That's not what I see in Linus's current tree:
>
> David, s6000 removal is queued for 3.18.
Then there is zero reason for me to apply this to my networking
tree.
^ permalink raw reply
* Re: [PATCH] net: s6gmac: remove driver
From: Max Filippov @ 2014-10-19 17:26 UTC (permalink / raw)
To: David Miller; +Cc: Daniel Glöckner, netdev, LKML
In-Reply-To: <20141019.124542.141206969262552652.davem@davemloft.net>
On Sun, Oct 19, 2014 at 8:45 PM, David Miller <davem@davemloft.net> wrote:
> From: Daniel Glöckner <dg@emlix.com>
> Date: Sun, 19 Oct 2014 00:49:05 +0200
>
>> The s6000 Xtensa support is removed from the kernel. There are no
>> other chips using this driver.
>
> That's not what I see in Linus's current tree:
David, s6000 removal is queued for 3.18.
--
Thanks.
-- Max
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2014-10-19 17:23 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
A quick batch of bug fixes:
1) Fix build with IPV6 disabled, from Eric Dumazet.
2) Several more cases of caching SKB data pointers across
calls to pskb_may_pull(), thus referencing potentially
free'd memory. From Li RongQing.
3) DSA phy code tests operation presence improperly, instead
of going:
if (x->ops->foo)
r = x->ops->foo(args);
it was going:
if (x->ops->foo(args))
r = x->ops->foo(args);
Fix from Andew Lunn.
Please pull, thanks a lot.
The following changes since commit f2d9da1a8375cbe53df5b415d059429013a3a79f:
bna: fix skb->truesize underestimation (2014-10-17 23:56:33 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
for you to fetch changes up to 228b16cb13dfa2f77354a9b144a07e86e2dda01c:
Net: DSA: Fix checking for get_phy_flags function (2014-10-19 12:46:31 -0400)
----------------------------------------------------------------
Andrew Lunn (1):
Net: DSA: Fix checking for get_phy_flags function
Eric Dumazet (1):
tcp: fix build error if IPv6 is not enabled
Li RongQing (3):
ipv4: fix a potential use after free in gre_offload.c
ipv6: fix a potential use after free in ip6_offload.c
ipv6: fix a potential use after free in sit.c
include/net/tcp.h | 2 ++
net/dsa/slave.c | 2 +-
net/ipv4/gre_offload.c | 6 +++---
net/ipv6/ip6_offload.c | 1 +
net/ipv6/sit.c | 6 +++---
5 files changed, 10 insertions(+), 7 deletions(-)
^ permalink raw reply
* Re: Fw: [Bug 86531] New: Kernel panic when using nmap
From: Alexei Starovoitov @ 2014-10-19 16:52 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev@vger.kernel.org
In-Reply-To: <20141019221149.2b590638@uryu.home.lan>
On Sun, Oct 19, 2014 at 6:41 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
>
> Begin forwarded message:
>
> Date: Sun, 19 Oct 2014 08:02:37 -0700
> From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
> To: "stephen@networkplumber.org" <stephen@networkplumber.org>
> Subject: [Bug 86531] New: Kernel panic when using nmap
>
>
> https://bugzilla.kernel.org/show_bug.cgi?id=86531
>
> Bug ID: 86531
> Summary: Kernel panic when using nmap
> Product: Networking
> Version: 2.5
> Kernel Version: 3.17.1
> Hardware: x86-64
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> Assignee: shemminger@linux-foundation.org
> Reporter: alxchk@gmail.com
> Regression: No
>
> Created attachment 154181
> --> https://bugzilla.kernel.org/attachment.cgi?id=154181&action=edit
> Crash log #1
>
> Strange crash appears the second time this day for me, when I starting nmap for
> scanning. Couldn't find any dependency. Anyway, dumps attached.
that's fixed in net tree and already in Linus's as well:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e0ee9c12157dc74e49e4731e0d07512e7d1ceb95
^ permalink raw reply
* Re: [PATCH v2] Net: DSA: Fix checking for get_phy_flags function
From: David Miller @ 2014-10-19 16:46 UTC (permalink / raw)
To: andrew; +Cc: f.fainelli, netdev
In-Reply-To: <1413729707-1682-1-git-send-email-andrew@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Sun, 19 Oct 2014 16:41:47 +0200
> The check for the presence or not of the optional switch function
> get_phy_flags() called the function, rather than checked to see if it
> is a NULL pointer. This causes a derefernce of a NULL pointer on all
> switch chips except the sf2, the only switch to implement this call.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Fixes: 6819563e646a ("net: dsa: allow switch drivers to specify phy_device::dev_flags")
> Cc: Florian Fainelli <f.fainelli@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH] net: s6gmac: remove driver
From: David Miller @ 2014-10-19 16:45 UTC (permalink / raw)
To: dg; +Cc: netdev, linux-kernel
In-Reply-To: <1413672545-8535-1-git-send-email-dg@emlix.com>
From: Daniel Glöckner <dg@emlix.com>
Date: Sun, 19 Oct 2014 00:49:05 +0200
> The s6000 Xtensa support is removed from the kernel. There are no
> other chips using this driver.
That's not what I see in Linus's current tree:
[davem@localhost linux]$ git grep XTENSA_VARIANT_S6000
arch/xtensa/Kconfig:config XTENSA_VARIANT_S6000
arch/xtensa/Kconfig: default "s6000" if XTENSA_VARIANT_S6000
^ permalink raw reply
* Fw: [Bug 86531] New: Kernel panic when using nmap
From: Stephen Hemminger @ 2014-10-19 16:41 UTC (permalink / raw)
To: netdev
Begin forwarded message:
Date: Sun, 19 Oct 2014 08:02:37 -0700
From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
To: "stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: [Bug 86531] New: Kernel panic when using nmap
https://bugzilla.kernel.org/show_bug.cgi?id=86531
Bug ID: 86531
Summary: Kernel panic when using nmap
Product: Networking
Version: 2.5
Kernel Version: 3.17.1
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
Assignee: shemminger@linux-foundation.org
Reporter: alxchk@gmail.com
Regression: No
Created attachment 154181
--> https://bugzilla.kernel.org/attachment.cgi?id=154181&action=edit
Crash log #1
Strange crash appears the second time this day for me, when I starting nmap for
scanning. Couldn't find any dependency. Anyway, dumps attached.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply
* [PATCH v2] Net: DSA: Fix checking for get_phy_flags function
From: Andrew Lunn @ 2014-10-19 14:41 UTC (permalink / raw)
To: davem; +Cc: f.fainelli, netdev, Andrew Lunn
The check for the presence or not of the optional switch function
get_phy_flags() called the function, rather than checked to see if it
is a NULL pointer. This causes a derefernce of a NULL pointer on all
switch chips except the sf2, the only switch to implement this call.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 6819563e646a ("net: dsa: allow switch drivers to specify phy_device::dev_flags")
Cc: Florian Fainelli <f.fainelli@gmail.com>
---
v2: Don't truncate the Fixes subject.
net/dsa/slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 9d3b12b4e03c..fbcba4bc4e08 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -596,7 +596,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
netif_carrier_off(slave_dev);
if (p->phy != NULL) {
- if (ds->drv->get_phy_flags(ds, port))
+ if (ds->drv->get_phy_flags)
p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
phy_attach(slave_dev, dev_name(&p->phy->dev),
--
2.1.1
^ permalink raw reply related
* [PATCH iproute2] ip link: Allow to filter devices by master dev
From: Vadim Kochan @ 2014-10-19 14:04 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
Added 'master' option to 'ip link show' command
to filter devices by master dev.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
ip/ipaddress.c | 16 ++++++++++++++++
ip/iplink.c | 2 +-
man/man8/ip-link.8.in | 9 ++++++++-
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 45729d8..8a0e2ab 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -56,6 +56,7 @@ static struct
int flushp;
int flushe;
int group;
+ int master;
} filter;
static int do_link;
@@ -480,6 +481,14 @@ int print_linkinfo(const struct sockaddr_nl *who,
return -1;
}
+ if (tb[IFLA_MASTER]) {
+ int master = *(int*)RTA_DATA(tb[IFLA_MASTER]);
+ if (filter.master > 0 && master != filter.master)
+ return -1;
+ }
+ else if (filter.master > 0)
+ return -1;
+
if (n->nlmsg_type == RTM_DELLINK)
fprintf(fp, "Deleted ");
@@ -1215,6 +1224,13 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
NEXT_ARG();
if (rtnl_group_a2n(&filter.group, *argv))
invarg("Invalid \"group\" value\n", *argv);
+ } else if (strcmp(*argv, "master") == 0) {
+ int ifindex;
+ NEXT_ARG();
+ ifindex = ll_name_to_index(*argv);
+ if (!ifindex)
+ invarg("Device does not exist\n", *argv);
+ filter.master = ifindex;
} else {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
diff --git a/ip/iplink.c b/ip/iplink.c
index 43b26f4..ce6eb3e 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -82,7 +82,7 @@ void iplink_usage(void)
fprintf(stderr, " [ master DEVICE ]\n");
fprintf(stderr, " [ nomaster ]\n");
fprintf(stderr, " [ addrgenmode { eui64 | none } ]\n");
- fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up]\n");
+ fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up] [master DEV]\n");
if (iplink_have_newlink()) {
fprintf(stderr, " ip link help [ TYPE ]\n");
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 383917a..279fe39 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -144,7 +144,9 @@ ip-link \- network device configuration
.B ip link show
.RI "[ " DEVICE " | "
.B group
-.IR GROUP " ]"
+.IR GROUP " | "
+.B master
+.IR DEVICE " ]"
.SH "DESCRIPTION"
.SS ip link add - add virtual link
@@ -658,6 +660,11 @@ specifies what group of devices to show.
.B up
only display running interfaces.
+.TP
+.BI master " DEVICE "
+.I DEVICE
+specifies the master device which enslaves devices to show.
+
.SH "EXAMPLES"
.PP
ip link show
--
2.1.0
^ permalink raw reply related
* [PATCH net] ax88179_178a: fix bonding failure
From: Ian Morgan @ 2014-10-19 12:05 UTC (permalink / raw)
To: netdev
The following patch fixes a bug which causes the ax88179_178a driver to be
incapable of being added to a bond.
When I brought up the issue with the bonding maintainers, they indicated
that the real problem was with the NIC driver which must return zero for
success (of setting the MAC address). I see that several other NIC drivers
follow that pattern by either simply always returing zero, or by passing
through a negative (error) result while rewriting any positive return code
to zero. With that same philisophy applied to the ax88179_178a driver, it
allows it to work correctly with the bonding driver.
I believe this is suitable for queuing in -stable, as it's a small, simple,
and obvious fix that corrects a defect with no other known workaround.
This patch is against vanilla 3.17(.0).
Signed-off-by: Ian Morgan <imorgan@primordial.ca>
drivers/net/usb/ax88179_178a.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- linux-3.17/drivers/net/usb/ax88179_178a.c.orig 2014-10-05 15:23:04.000000000 -0400
+++ linux-3.17/drivers/net/usb/ax88179_178a.c 2014-10-15 09:07:31.217810217 -0400
@@ -937,6 +937,7 @@ static int ax88179_set_mac_addr(struct n
{
struct usbnet *dev = netdev_priv(net);
struct sockaddr *addr = p;
+ int ret;
if (netif_running(net))
return -EBUSY;
@@ -946,8 +947,12 @@ static int ax88179_set_mac_addr(struct n
memcpy(net->dev_addr, addr->sa_data, ETH_ALEN);
/* Set the MAC address */
- return ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
+ ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
ETH_ALEN, net->dev_addr);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
static const struct net_device_ops ax88179_netdev_ops = {
--
Ian Morgan
^ permalink raw reply
* [PATCH net 2/2] enic: Do not call napi_disable when preemption is disabled.
From: Govindarajulu Varadarajan @ 2014-10-19 8:50 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
In-Reply-To: <1413708628-25690-1-git-send-email-_govind@gmx.com>
In enic_stop, we disable preemption using local_bh_disable(). We disable
preemption to wait for busy_poll to finish.
napi_disable should not be called here as it might sleep.
Moving napi_disable() call out side of local_bh_disable.
BUG: sleeping function called from invalid context at include/linux/netdevice.h:477
in_atomic(): 1, irqs_disabled(): 0, pid: 443, name: ifconfig
INFO: lockdep is turned off.
Preemption disabled at:[<ffffffffa029c5c4>] enic_rfs_flw_tbl_free+0x34/0xd0 [enic]
CPU: 31 PID: 443 Comm: ifconfig Not tainted 3.17.0-netnext-05504-g59f35b8 #268
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
ffff8800dac10000 ffff88020b8dfcb8 ffffffff8148a57c 0000000000000000
ffff88020b8dfcd0 ffffffff8107e253 ffff8800dac12a40 ffff88020b8dfd10
ffffffffa029305b ffff88020b8dfd48 ffff8800dac10000 ffff88020b8dfd48
Call Trace:
[<ffffffff8148a57c>] dump_stack+0x4e/0x7a
[<ffffffff8107e253>] __might_sleep+0x123/0x1a0
[<ffffffffa029305b>] enic_stop+0xdb/0x4d0 [enic]
[<ffffffff8138ed7d>] __dev_close_many+0x9d/0xf0
[<ffffffff8138ef81>] __dev_close+0x31/0x50
[<ffffffff813974a8>] __dev_change_flags+0x98/0x160
[<ffffffff81397594>] dev_change_flags+0x24/0x60
[<ffffffff814085fd>] devinet_ioctl+0x63d/0x710
[<ffffffff81139c16>] ? might_fault+0x56/0xc0
[<ffffffff81409ef5>] inet_ioctl+0x65/0x90
[<ffffffff813768e0>] sock_do_ioctl+0x20/0x50
[<ffffffff81376ebb>] sock_ioctl+0x20b/0x2e0
[<ffffffff81197250>] do_vfs_ioctl+0x2e0/0x500
[<ffffffff81492619>] ? sysret_check+0x22/0x5d
[<ffffffff81285f23>] ? __this_cpu_preempt_check+0x13/0x20
[<ffffffff8109fe19>] ? trace_hardirqs_on_caller+0x119/0x270
[<ffffffff811974ac>] SyS_ioctl+0x3c/0x80
[<ffffffff814925ed>] system_call_fastpath+0x1a/0x1f
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 929bfe7..180e53f 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1674,13 +1674,13 @@ static int enic_stop(struct net_device *netdev)
enic_dev_disable(enic);
- local_bh_disable();
for (i = 0; i < enic->rq_count; i++) {
napi_disable(&enic->napi[i]);
+ local_bh_disable();
while (!enic_poll_lock_napi(&enic->rq[i]))
mdelay(1);
+ local_bh_enable();
}
- local_bh_enable();
netif_carrier_off(netdev);
netif_tx_disable(netdev);
--
2.1.0
^ permalink raw reply related
* [PATCH net 1/2] enic: fix possible deadlock in enic_stop/ enic_rfs_flw_tbl_free
From: Govindarajulu Varadarajan @ 2014-10-19 8:50 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
In-Reply-To: <1413708628-25690-1-git-send-email-_govind@gmx.com>
The following warning is shown when spinlock debug is enabled.
This occurs when enic_flow_may_expire timer function is running and
enic_stop is called on same CPU.
Fix this by using spink_lock_bh().
=================================
[ INFO: inconsistent lock state ]
3.17.0-netnext-05504-g59f35b8 #268 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
ifconfig/443 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&(&enic->rfs_h.lock)->rlock){+.?...}, at:
enic_rfs_flw_tbl_free+0x34/0xd0 [enic]
{IN-SOFTIRQ-W} state was registered at:
[<ffffffff810a25af>] __lock_acquire+0x83f/0x21c0
[<ffffffff810a45f2>] lock_acquire+0xa2/0xd0
[<ffffffff814913fc>] _raw_spin_lock+0x3c/0x80
[<ffffffffa029c3d5>] enic_flow_may_expire+0x25/0x130[enic]
[<ffffffff810bcd07>] call_timer_fn+0x77/0x100
[<ffffffff810bd8e3>] run_timer_softirq+0x1e3/0x270
[<ffffffff8105f9ae>] __do_softirq+0x14e/0x280
[<ffffffff8105fdae>] irq_exit+0x8e/0xb0
[<ffffffff8103da0f>] smp_apic_timer_interrupt+0x3f/0x50
[<ffffffff81493742>] apic_timer_interrupt+0x72/0x80
[<ffffffff81018143>] default_idle+0x13/0x20
[<ffffffff81018a6a>] arch_cpu_idle+0xa/0x10
[<ffffffff81097676>] cpu_startup_entry+0x2c6/0x330
[<ffffffff8103b7ad>] start_secondary+0x21d/0x290
irq event stamp: 2997
hardirqs last enabled at (2997): [<ffffffff81491865>] _raw_spin_unlock_irqrestore+0x65/0x90
hardirqs last disabled at (2996): [<ffffffff814915e6>] _raw_spin_lock_irqsave+0x26/0x90
softirqs last enabled at (2968): [<ffffffff813b57a3>] dev_deactivate_many+0x213/0x260
softirqs last disabled at (2966): [<ffffffff813b5783>] dev_deactivate_many+0x1f3/0x260
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&enic->rfs_h.lock)->rlock);
<Interrupt>
lock(&(&enic->rfs_h.lock)->rlock);
*** DEADLOCK ***
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
drivers/net/ethernet/cisco/enic/enic_clsf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c
index 69dfd3c..0be6850 100644
--- a/drivers/net/ethernet/cisco/enic/enic_clsf.c
+++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c
@@ -86,7 +86,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
int i;
enic_rfs_timer_stop(enic);
- spin_lock(&enic->rfs_h.lock);
+ spin_lock_bh(&enic->rfs_h.lock);
enic->rfs_h.free = 0;
for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) {
struct hlist_head *hhead;
@@ -100,7 +100,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
kfree(n);
}
}
- spin_unlock(&enic->rfs_h.lock);
+ spin_unlock_bh(&enic->rfs_h.lock);
}
struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id)
@@ -128,7 +128,7 @@ void enic_flow_may_expire(unsigned long data)
bool res;
int j;
- spin_lock(&enic->rfs_h.lock);
+ spin_lock_bh(&enic->rfs_h.lock);
for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) {
struct hlist_head *hhead;
struct hlist_node *tmp;
@@ -148,7 +148,7 @@ void enic_flow_may_expire(unsigned long data)
}
}
}
- spin_unlock(&enic->rfs_h.lock);
+ spin_unlock_bh(&enic->rfs_h.lock);
mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4);
}
@@ -183,7 +183,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
return -EPROTONOSUPPORT;
tbl_idx = skb_get_hash_raw(skb) & ENIC_RFS_FLW_MASK;
- spin_lock(&enic->rfs_h.lock);
+ spin_lock_bh(&enic->rfs_h.lock);
n = htbl_key_search(&enic->rfs_h.ht_head[tbl_idx], &keys);
if (n) { /* entry already present */
@@ -277,7 +277,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
}
ret_unlock:
- spin_unlock(&enic->rfs_h.lock);
+ spin_unlock_bh(&enic->rfs_h.lock);
return res;
}
--
2.1.0
^ permalink raw reply related
* [PATCH net 0/2] enic: Bug fixes
From: Govindarajulu Varadarajan @ 2014-10-19 8:50 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
This series fixes the following problem.
Please apply this to net.
Govindarajulu Varadarajan (2):
enic: fix possible deadlock in enic_stop/ enic_rfs_flw_tbl_free
enic: Do not call napi_disable when preemption is disabled.
drivers/net/ethernet/cisco/enic/enic_clsf.c | 12 ++++++------
drivers/net/ethernet/cisco/enic/enic_main.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
--
2.1.0
^ permalink raw reply
* [PATCH iproute2 v2] ss: Refactor to use macro for define diag nl request
From: Vadim Kochan @ 2014-10-19 8:01 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
misc/ss.c | 56 +++++++++++++++++---------------------------------------
1 file changed, 17 insertions(+), 39 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 2420b51..d067e5f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -41,6 +41,19 @@
#include <linux/packet_diag.h>
#include <linux/netlink_diag.h>
+#define DIAG_REQUEST(_req, _r) \
+ struct { \
+ struct nlmsghdr nlh; \
+ _r; \
+ } _req = { \
+ .nlh = { \
+ .nlmsg_type = SOCK_DIAG_BY_FAMILY, \
+ .nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,\
+ .nlmsg_seq = 123456, \
+ .nlmsg_len = sizeof(_req), \
+ }, \
+ }
+
#if HAVE_SELINUX
#include <selinux/selinux.h>
#else
@@ -1795,10 +1808,7 @@ static int tcpdiag_send(int fd, int protocol, struct filter *f)
static int sockdiag_send(int family, int fd, int protocol, struct filter *f)
{
struct sockaddr_nl nladdr;
- struct {
- struct nlmsghdr nlh;
- struct inet_diag_req_v2 r;
- } req;
+ DIAG_REQUEST(req, struct inet_diag_req_v2 r);
char *bc = NULL;
int bclen;
struct msghdr msg;
@@ -1811,11 +1821,6 @@ static int sockdiag_send(int family, int fd, int protocol, struct filter *f)
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
- req.nlh.nlmsg_len = sizeof(req);
- req.nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
- req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
- req.nlh.nlmsg_pid = 0;
- req.nlh.nlmsg_seq = 123456;
memset(&req.r, 0, sizeof(req.r));
req.r.sdiag_family = family;
req.r.sdiag_protocol = protocol;
@@ -2577,16 +2582,7 @@ close_it:
static int unix_show_netlink(struct filter *f, FILE *dump_fp)
{
- struct {
- struct nlmsghdr nlh;
- struct unix_diag_req r;
- } req;
-
- memset(&req, 0, sizeof(req));
- req.nlh.nlmsg_len = sizeof(req);
- req.nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
- req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
- req.nlh.nlmsg_seq = 123456;
+ DIAG_REQUEST(req, struct unix_diag_req r);
req.r.sdiag_family = AF_UNIX;
req.r.udiag_states = f->states;
@@ -2778,21 +2774,12 @@ static int packet_show_sock(struct nlmsghdr *nlh, struct filter *f)
static int packet_show_netlink(struct filter *f, FILE *dump_fp)
{
int fd;
- struct {
- struct nlmsghdr nlh;
- struct packet_diag_req r;
- } req;
+ DIAG_REQUEST(req, struct packet_diag_req r);
char buf[8192];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
return -1;
- memset(&req, 0, sizeof(req));
- req.nlh.nlmsg_len = sizeof(req);
- req.nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
- req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
- req.nlh.nlmsg_seq = 123456;
-
req.r.sdiag_family = AF_PACKET;
req.r.pdiag_show = PACKET_SHOW_INFO | PACKET_SHOW_MEMINFO | PACKET_SHOW_FILTER;
@@ -3091,16 +3078,7 @@ static int netlink_show_sock(struct nlmsghdr *nlh, struct filter *f)
static int netlink_show_netlink(struct filter *f, FILE *dump_fp)
{
- struct {
- struct nlmsghdr nlh;
- struct netlink_diag_req r;
- } req;
-
- memset(&req, 0, sizeof(req));
- req.nlh.nlmsg_len = sizeof(req);
- req.nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
- req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
- req.nlh.nlmsg_seq = 123456;
+ DIAG_REQUEST(req, struct netlink_diag_req r);
req.r.sdiag_family = AF_NETLINK;
req.r.sdiag_protocol = NDIAG_PROTO_ALL;
--
2.1.0
^ permalink raw reply related
* Re: [PATCH iproute2] ss: Refactor to use macro for define diag nl request
From: vadim4j @ 2014-10-19 7:09 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20141019113920.3f0fa575@uryu.home.lan>
On Sun, Oct 19, 2014 at 11:39:20AM +0530, Stephen Hemminger wrote:
>
> No need to initialize to zero.
>
OK, will remove and resend it.
Thanks.
^ permalink raw reply
* Re: [PATCH iproute2] ss: Refactor to use macro for define diag nl request
From: Stephen Hemminger @ 2014-10-19 6:09 UTC (permalink / raw)
To: Vadim Kochan; +Cc: netdev
In-Reply-To: <1413676229-23258-1-git-send-email-vadim4j@gmail.com>
On Sun, 19 Oct 2014 02:50:29 +0300
Vadim Kochan <vadim4j@gmail.com> wrote:
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---
> misc/ss.c | 57 ++++++++++++++++++---------------------------------------
> 1 file changed, 18 insertions(+), 39 deletions(-)
>
> diff --git a/misc/ss.c b/misc/ss.c
> index 2420b51..261847b 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -41,6 +41,20 @@
> #include <linux/packet_diag.h>
> #include <linux/netlink_diag.h>
>
> +#define DIAG_REQUEST(_req, _r) \
> + struct { \
> + struct nlmsghdr nlh; \
> + _r; \
> + } _req = { \
> + .nlh = { \
> + .nlmsg_type = SOCK_DIAG_BY_FAMILY, \
> + .nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,\
> + .nlmsg_seq = 123456, \
> + .nlmsg_len = sizeof(_req), \
> + .nlmsg_pid = 0, \
> + }, \
> + }
No need to initialize to zero.
Not a big fan of macro's but it does make the code more readable in this case.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox