* Re: [PATCH] ieee802154: verify packet size before trying to allocate it
From: Alan Cox @ 2012-06-10 11:24 UTC (permalink / raw)
To: Sasha Levin
Cc: dbaryshkov, slapin, davem, linux-zigbee-devel, netdev,
linux-kernel
In-Reply-To: <1339326619-1753-1-git-send-email-levinsasha928@gmail.com>
On Sun, 10 Jun 2012 13:10:19 +0200
Sasha Levin <levinsasha928@gmail.com> wrote:
> Currently when sending data over datagram, the send function will attempt to
> allocate any size passed on from the userspace.
>
> We should make sure that this size is checked and limited. The maximum size
> of an IP packet seemed like the safest limit here.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>
> Change in v2:
> - Limit by maximum size the protocol supports.
>
> net/ieee802154/dgram.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
> index 6fbb2ad..628498c 100644
> --- a/net/ieee802154/dgram.c
> +++ b/net/ieee802154/dgram.c
> @@ -232,6 +232,11 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
>
> hlen = LL_RESERVED_SPACE(dev);
> tlen = dev->needed_tailroom;
> + if (hlen + tlen + size > IEEE802154_MTU) {
> + err = -EMSGSIZE;
> + goto out;
What stops an overflow at this point. We'll then pass a small value to
sock_alloc_send_skb/sock_alloc_send_pskb and copy a large number of bytes
into it.
This does seem to be already broken, and not fixed by the patch ?
Alan
^ permalink raw reply
* [PATCH] ieee802154: verify packet size before trying to allocate it
From: Sasha Levin @ 2012-06-10 11:10 UTC (permalink / raw)
To: dbaryshkov, slapin, davem
Cc: linux-zigbee-devel, netdev, linux-kernel, Sasha Levin
Currently when sending data over datagram, the send function will attempt to
allocate any size passed on from the userspace.
We should make sure that this size is checked and limited. The maximum size
of an IP packet seemed like the safest limit here.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
Change in v2:
- Limit by maximum size the protocol supports.
net/ieee802154/dgram.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index 6fbb2ad..628498c 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -232,6 +232,11 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
hlen = LL_RESERVED_SPACE(dev);
tlen = dev->needed_tailroom;
+ if (hlen + tlen + size > IEEE802154_MTU) {
+ err = -EMSGSIZE;
+ goto out;
+ }
+
skb = sock_alloc_send_skb(sk, hlen + tlen + size,
msg->msg_flags & MSG_DONTWAIT,
&err);
--
1.7.8.6
^ permalink raw reply related
* Re: [PATCH] virtio-net: fix a race on 32bit arches
From: Michael S. Tsirkin @ 2012-06-10 10:25 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, linux-kernel, virtualization, Stephen Hemminger
In-Reply-To: <1338971724.2760.3913.camel@edumazet-glaptop>
On Wed, Jun 06, 2012 at 10:35:24AM +0200, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit 3fa2a1df909 (virtio-net: per cpu 64 bit stats (v2)) added a race
> on 32bit arches.
>
> We must use separate syncp for rx and tx path as they can be run at the
> same time on different cpus. Thus one sequence increment can be lost and
> readers spin forever.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Stephen Hemminger <shemminger@vyatta.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
I'm still thinking about moving tx to take a xmit lock long term,
meanwhile this fix appears appropriate for 3.5.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Dave, can you pick this up pls?
> ---
> drivers/net/virtio_net.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 5214b1e..f18149a 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -42,7 +42,8 @@ module_param(gso, bool, 0444);
> #define VIRTNET_DRIVER_VERSION "1.0.0"
>
> struct virtnet_stats {
> - struct u64_stats_sync syncp;
> + struct u64_stats_sync tx_syncp;
> + struct u64_stats_sync rx_syncp;
> u64 tx_bytes;
> u64 tx_packets;
>
> @@ -300,10 +301,10 @@ static void receive_buf(struct net_device *dev, void *buf, unsigned int len)
>
> hdr = skb_vnet_hdr(skb);
>
> - u64_stats_update_begin(&stats->syncp);
> + u64_stats_update_begin(&stats->rx_syncp);
> stats->rx_bytes += skb->len;
> stats->rx_packets++;
> - u64_stats_update_end(&stats->syncp);
> + u64_stats_update_end(&stats->rx_syncp);
>
> if (hdr->hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
> pr_debug("Needs csum!\n");
> @@ -565,10 +566,10 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)
> while ((skb = virtqueue_get_buf(vi->svq, &len)) != NULL) {
> pr_debug("Sent skb %p\n", skb);
>
> - u64_stats_update_begin(&stats->syncp);
> + u64_stats_update_begin(&stats->tx_syncp);
> stats->tx_bytes += skb->len;
> stats->tx_packets++;
> - u64_stats_update_end(&stats->syncp);
> + u64_stats_update_end(&stats->tx_syncp);
>
> tot_sgs += skb_vnet_hdr(skb)->num_sg;
> dev_kfree_skb_any(skb);
> @@ -703,12 +704,16 @@ static struct rtnl_link_stats64 *virtnet_stats(struct net_device *dev,
> u64 tpackets, tbytes, rpackets, rbytes;
>
> do {
> - start = u64_stats_fetch_begin(&stats->syncp);
> + start = u64_stats_fetch_begin(&stats->tx_syncp);
> tpackets = stats->tx_packets;
> tbytes = stats->tx_bytes;
> + } while (u64_stats_fetch_retry(&stats->tx_syncp, start));
> +
> + do {
> + start = u64_stats_fetch_begin(&stats->rx_syncp);
> rpackets = stats->rx_packets;
> rbytes = stats->rx_bytes;
> - } while (u64_stats_fetch_retry(&stats->syncp, start));
> + } while (u64_stats_fetch_retry(&stats->rx_syncp, start));
>
> tot->rx_packets += rpackets;
> tot->tx_packets += tpackets;
>
^ permalink raw reply
* Re: [PATCH] virtio-net: fix a race on 32bit arches
From: Michael S. Tsirkin @ 2012-06-10 10:22 UTC (permalink / raw)
To: Eric Dumazet
Cc: Rusty Russell, Jason Wang, netdev, linux-kernel, virtualization,
Stephen Hemminger
In-Reply-To: <1339323674.6001.246.camel@edumazet-glaptop>
On Sun, Jun 10, 2012 at 12:21:14PM +0200, Eric Dumazet wrote:
> On Sun, 2012-06-10 at 10:03 +0300, Michael S. Tsirkin wrote:
>
> > One question though: do we want to lay the structure
> > out so that the rx sync structure precedes the rx counters?
> >
>
> I am not sure its worth having holes in the structure, since its percpu
> data.
>
> That would be 8 bytes lost per cpu and per device.
Right, I forgot it's per cpu.
^ permalink raw reply
* Re: [PATCH] virtio-net: fix a race on 32bit arches
From: Eric Dumazet @ 2012-06-10 10:21 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: netdev, linux-kernel, virtualization, Stephen Hemminger
In-Reply-To: <20120610070325.GA14010@redhat.com>
On Sun, 2012-06-10 at 10:03 +0300, Michael S. Tsirkin wrote:
> One question though: do we want to lay the structure
> out so that the rx sync structure precedes the rx counters?
>
I am not sure its worth having holes in the structure, since its percpu
data.
That would be 8 bytes lost per cpu and per device.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 10:16 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
In-Reply-To: <20120609.221801.2226110181753212240.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Sat, Jun 09, 2012 at 10:18:01PM -0400, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Sat, 09 Jun 2012 19:09:29 -0700 (PDT)
>
> > From: Fengguang Wu <wfg@linux.intel.com>
> > Date: Sun, 10 Jun 2012 10:08:01 +0800
> >
> >> And in another config, an old error still triggers:
> >>
> >> net/ipv4/inetpeer.c: In function ‘family_to_base’:
> >> net/ipv4/inetpeer.c:397:50: error: ‘struct net’ has no member named ‘ipv6’
> >> net/ipv4/inetpeer.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
> >>
> >> I'm building this patch on top of net-next master.
> >
> > What a fucking mess Gao created, I'll fix this.
> >
> > Thanks for the report.
>
> I just pushed the following to net-next:
>
> --------------------
> inet: Pass inetpeer root into inet_getpeer*() interfaces.
>
> Otherwise we reference potentially non-existing members when
> ipv6 is disabled.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> include/net/inetpeer.h | 10 +++++-----
> net/ipv4/inetpeer.c | 9 +--------
> net/ipv4/ip_fragment.c | 2 +-
> net/ipv4/route.c | 6 +++---
> net/ipv6/route.c | 2 +-
> 5 files changed, 11 insertions(+), 18 deletions(-)
It triggers some other errors:
net/ipv4/inetpeer.c: In function ‘inetpeer_invalidate_tree’:
net/ipv4/inetpeer.c:585:9: error: implicit declaration of function ‘family_to_base’ [-Werror=implicit-function-declaration]
net/ipv4/inetpeer.c:585:32: warning: initialization makes pointer from integer without a cast [enabled by default]
net/ipv6/tcp_ipv6.c:1758:2: warning: passing argument 1 of ‘inet_getpeer_v6’ from incompatible pointer type [enabled by default]
include/net/inetpeer.h:101:33: note: expected ‘struct inet_peer_base *’ but argument is of type ‘struct net *’
net/ipv4/tcp_ipv4.c:1843:2: warning: passing argument 1 of ‘inet_getpeer_v4’ from incompatible pointer type [enabled by default]
include/net/inetpeer.h:90:33: note: expected ‘struct inet_peer_base *’ but argument is of type ‘struct net *’
which can be fixed by the following diff.
Thanks,
Fengguang
---
net/ipv4/inetpeer.c | 6 ++++++
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 98cf1f8..7ad6b76 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -391,6 +391,12 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base,
call_rcu(&p->rcu, inetpeer_free_rcu);
}
+static struct inet_peer_base *family_to_base(struct net *net,
+ int family)
+{
+ return family == AF_INET ? net->ipv4.peers : net->ipv6.peers;
+}
+
/* perform garbage collect on all items stacked during a lookup */
static int inet_peer_gc(struct inet_peer_base *base,
struct inet_peer __rcu **stack[PEER_MAXDEPTH],
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 77f049d..cf7fe92 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1840,7 +1840,7 @@ void *tcp_v4_tw_get_peer(struct sock *sk)
const struct inet_timewait_sock *tw = inet_twsk(sk);
struct net *net = sock_net(sk);
- return inet_getpeer_v4(net, tw->tw_daddr, 1);
+ return inet_getpeer_v4(net->ipv4.peers, tw->tw_daddr, 1);
}
EXPORT_SYMBOL(tcp_v4_tw_get_peer);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b5ecf37..927c029 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1755,7 +1755,7 @@ static void *tcp_v6_tw_get_peer(struct sock *sk)
if (tw->tw_family == AF_INET)
return tcp_v4_tw_get_peer(sk);
- return inet_getpeer_v6(net, &tw6->tw_v6_daddr, 1);
+ return inet_getpeer_v6(net->ipv6.peers, &tw6->tw_v6_daddr, 1);
}
static struct timewait_sock_ops tcp6_timewait_sock_ops = {
--
1.7.10
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply related
* [PATCH 1/1 v3] Ethtool: Add EEE support
From: Yuval Mintz @ 2012-06-10 8:48 UTC (permalink / raw)
To: bhutchings, netdev; +Cc: eilong, peppe.cavallaro, Yuval Mintz
This patch adds 2 new ethtool commands which can be
used to manipulate network interfaces' support in
EEE.
Output of 'get' has the following form:
EEE Settings for p2p1:
EEE status: enabled - active
Tx LPI: 1000 (us)
Supported EEE link modes: 10000baseT/Full
Advertised EEE link modes: 10000baseT/Full
Link partner advertised EEE link modes: 10000baseT/Full
Thanks goes to Giuseppe Cavallaro for his original patch.
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
Changes from Version 2:
- Changed --get-eee into --show-eee
- Corrected EEE tests in test-cmdline.c
- Corrected documentation
---
ethtool.8.in | 32 +++++++++++++
ethtool.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++--------
test-cmdline.c | 11 +++++
3 files changed, 159 insertions(+), 20 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index 70ae31d..178322b 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -325,6 +325,16 @@ ethtool \- query or control network driver and hardware settings
.I devname flag
.A1 on off
.RB ...
+.HP
+.B ethtool \-\-show\-eee
+.I devname
+.HP
+.B ethtool \-\-set\-eee
+.I devname
+.B2 eee on off
+.B2 tx-lpi on off
+.BN tx-timer
+.BN advertise
.
.\" Adjust lines (i.e. full justification) and hyphenate.
.ad
@@ -810,6 +820,28 @@ Sets the device's private flags as specified.
.I flag
.A1 on off
Sets the state of the named private flag.
+.TP
+.B \-\-show\-eee
+Queries the specified network device for its support of Efficient Energy
+Ethernet (according to the IEEE 802.3az specifications)
+.TP
+.B \-\-set\-eee
+Sets the device EEE behaviour.
+.TP
+.A2 eee on off
+Enables/disables the device support of EEE.
+.TP
+.A2 tx-lpi on off
+Determines whether the device should assert its Tx LPI.
+.TP
+.BI advertise \ N
+Sets the speeds for which the device should advertise EEE capabiliities.
+Values are as for
+.B \-\-change advertise
+.TP
+.BI tx-timer \ N
+Sets the amount of time the device should stay in idle mode prior to asserting
+its Tx LPI (in microseconds). This has meaning only when Tx LPI is enabled.
.SH BUGS
Not supported (in part or whole) on all network drivers.
.SH AUTHOR
diff --git a/ethtool.c b/ethtool.c
index f09a032..73e0e28 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -416,7 +416,8 @@ static int do_version(struct cmd_context *ctx)
return 0;
}
-static void dump_link_caps(const char *prefix, const char *an_prefix, u32 mask);
+static void dump_link_caps(const char *prefix, const char *an_prefix, u32 mask,
+ int link_mode_only);
static void dump_supported(struct ethtool_cmd *ep)
{
@@ -435,14 +436,15 @@ static void dump_supported(struct ethtool_cmd *ep)
fprintf(stdout, "FIBRE ");
fprintf(stdout, "]\n");
- dump_link_caps("Supported", "Supports", mask);
+ dump_link_caps("Supported", "Supports", mask, 0);
}
/* Print link capability flags (supported, advertised or lp_advertised).
* Assumes that the corresponding SUPPORTED and ADVERTISED flags are equal.
*/
static void
-dump_link_caps(const char *prefix, const char *an_prefix, u32 mask)
+dump_link_caps(const char *prefix, const char *an_prefix, u32 mask,
+ int link_mode_only)
{
int indent;
int did1;
@@ -527,24 +529,26 @@ dump_link_caps(const char *prefix, const char *an_prefix, u32 mask)
fprintf(stdout, "Not reported");
fprintf(stdout, "\n");
- fprintf(stdout, " %s pause frame use: ", prefix);
- if (mask & ADVERTISED_Pause) {
- fprintf(stdout, "Symmetric");
- if (mask & ADVERTISED_Asym_Pause)
- fprintf(stdout, " Receive-only");
- fprintf(stdout, "\n");
- } else {
- if (mask & ADVERTISED_Asym_Pause)
- fprintf(stdout, "Transmit-only\n");
+ if (!link_mode_only) {
+ fprintf(stdout, " %s pause frame use: ", prefix);
+ if (mask & ADVERTISED_Pause) {
+ fprintf(stdout, "Symmetric");
+ if (mask & ADVERTISED_Asym_Pause)
+ fprintf(stdout, " Receive-only");
+ fprintf(stdout, "\n");
+ } else {
+ if (mask & ADVERTISED_Asym_Pause)
+ fprintf(stdout, "Transmit-only\n");
+ else
+ fprintf(stdout, "No\n");
+ }
+
+ fprintf(stdout, " %s auto-negotiation: ", an_prefix);
+ if (mask & ADVERTISED_Autoneg)
+ fprintf(stdout, "Yes\n");
else
fprintf(stdout, "No\n");
}
-
- fprintf(stdout, " %s auto-negotiation: ", an_prefix);
- if (mask & ADVERTISED_Autoneg)
- fprintf(stdout, "Yes\n");
- else
- fprintf(stdout, "No\n");
}
static int dump_ecmd(struct ethtool_cmd *ep)
@@ -552,10 +556,11 @@ static int dump_ecmd(struct ethtool_cmd *ep)
u32 speed;
dump_supported(ep);
- dump_link_caps("Advertised", "Advertised", ep->advertising);
+ dump_link_caps("Advertised", "Advertised", ep->advertising, 0);
if (ep->lp_advertising)
dump_link_caps("Link partner advertised",
- "Link partner advertised", ep->lp_advertising);
+ "Link partner advertised", ep->lp_advertising,
+ 0);
fprintf(stdout, " Speed: ");
speed = ethtool_cmd_speed(ep);
@@ -1234,6 +1239,34 @@ static int dump_rxfhash(int fhash, u64 val)
return 0;
}
+static void dump_eeecmd(struct ethtool_eee *ep)
+{
+
+ fprintf(stdout, " EEE status: ");
+ if (!ep->supported) {
+ fprintf(stdout, "not supported\n");
+ return;
+ } else if (!ep->eee_enabled) {
+ fprintf(stdout, "disabled\n");
+ } else {
+ fprintf(stdout, "enabled - ");
+ if (ep->eee_active)
+ fprintf(stdout, "active\n");
+ else
+ fprintf(stdout, "inactive\n");
+ }
+
+ fprintf(stdout, " Tx LPI:");
+ if (ep->tx_lpi_enabled)
+ fprintf(stdout, " %d (us)\n", ep->tx_lpi_timer);
+ else
+ fprintf(stdout, " disabled\n");
+
+ dump_link_caps("Supported EEE", "", ep->supported, 1);
+ dump_link_caps("Advertised EEE", "", ep->advertised, 1);
+ dump_link_caps("Link partner advertised EEE", "", ep->lp_advertised, 1);
+}
+
#define N_SOTS 7
static char *so_timestamping_labels[N_SOTS] = {
@@ -3463,6 +3496,63 @@ static int do_getmodule(struct cmd_context *ctx)
return 0;
}
+static int do_geee(struct cmd_context *ctx)
+{
+ struct ethtool_eee eeecmd;
+
+ if (ctx->argc != 0)
+ exit_bad_args();
+
+ eeecmd.cmd = ETHTOOL_GEEE;
+ if (send_ioctl(ctx, &eeecmd)) {
+ perror("Cannot get EEE settings");
+ return 1;
+ }
+
+ fprintf(stdout, "EEE Settings for %s:\n", ctx->devname);
+ dump_eeecmd(&eeecmd);
+
+ return 0;
+}
+
+static int do_seee(struct cmd_context *ctx)
+{
+ int adv_c = -1, lpi_c = -1, lpi_time_c = -1, eee_c = -1;
+ int change = -1, change2 = -1;
+ struct ethtool_eee eeecmd;
+ struct cmdline_info cmdline_eee[] = {
+ { "advertise", CMDL_U32, &adv_c, &eeecmd.advertised },
+ { "tx-lpi", CMDL_BOOL, &lpi_c, &eeecmd.tx_lpi_enabled },
+ { "tx-timer", CMDL_U32, &lpi_time_c, &eeecmd.tx_lpi_timer},
+ { "eee", CMDL_BOOL, &eee_c, &eeecmd.eee_enabled},
+ };
+
+ if (ctx->argc == 0)
+ exit_bad_args();
+
+ parse_generic_cmdline(ctx, &change, cmdline_eee,
+ ARRAY_SIZE(cmdline_eee));
+
+ eeecmd.cmd = ETHTOOL_GEEE;
+ if (send_ioctl(ctx, &eeecmd)) {
+ perror("Cannot get EEE settings");
+ return 1;
+ }
+
+ do_generic_set(cmdline_eee, ARRAY_SIZE(cmdline_eee), &change2);
+
+ if (change2) {
+
+ eeecmd.cmd = ETHTOOL_SEEE;
+ if (send_ioctl(ctx, &eeecmd)) {
+ perror("Cannot set EEE settings");
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
#ifndef TEST_ETHTOOL
int send_ioctl(struct cmd_context *ctx, void *cmd)
{
@@ -3611,6 +3701,12 @@ static const struct option {
" [ hex on|off ]\n"
" [ offset N ]\n"
" [ length N ]\n" },
+ { "--show-eee", 1, do_geee, "Show EEE settings"},
+ { "--set-eee", 1, do_seee, "Set EEE settings",
+ " [ eee on|off ]\n"
+ " [ advertise %x ]\n"
+ " [ tx-lpi on|off ]\n"
+ " [ tx-timer %d ]\n"},
{ "-h|--help", 0, show_usage, "Show this help" },
{ "--version", 0, do_version, "Show version number" },
{}
diff --git a/test-cmdline.c b/test-cmdline.c
index 978c312..8fc2b48 100644
--- a/test-cmdline.c
+++ b/test-cmdline.c
@@ -217,6 +217,17 @@ static struct test_case {
{ 0, "-m devname hex off" },
{ 1, "-m devname hex on raw on" },
{ 0, "-m devname offset 4 length 6" },
+ { 1, "--show-eee" },
+ { 0, "--show-eee devname" },
+ { 1, "--show-eee devname foo" },
+ { 1, "--set-eee" },
+ { 1, "--set-eee devname" },
+ { 0, "--set-eee devname eee on" },
+ { 0, "--set-eee devname eee off" },
+ { 0, "--set-eee devname tx-lpi on" },
+ { 0, "--set-eee devname tx-lpi off" },
+ { 1, "--set-eee devname tx-timer foo" },
+ { 1, "--set-eee devname advertise foo" },
/* can't test --set-priv-flags yet */
{ 0, "-h" },
{ 0, "--help" },
--
1.7.9.rc2
^ permalink raw reply related
* Re: PPPoE performance regression
From: David Woodhouse @ 2012-06-10 8:32 UTC (permalink / raw)
To: Nathan Williams; +Cc: Karl Hiramoto, David S. Miller, netdev
In-Reply-To: <1339289425.2661.27.camel@laptop>
[-- Attachment #1: Type: text/plain, Size: 2477 bytes --]
On Sun, 2012-06-10 at 10:50 +1000, Nathan Williams wrote:
> > When using iperf with UDP, we can get 20Mbps downstream, but only about
> > 15Mbps throughput when using TCP on a short ADSL line (line sync at
> > 25Mbps). Using iperf to send UDP traffic upstream at the same time
> > doesn't affect the downstream rate.
>
> ...
>
> I found the change responsible for the performance problem and rebuilt
> OpenWrt with the patch reversed on kernel 3.3.8 to confirm everything
> still works. So the TX buffer is getting full, which causes the netif
> queue to be stopped and restarted after some skbs have been freed?
The *Ethernet* netif queue, yes. But not the PPP netif queue, I believe.
I think the PPP code keeps just blindly calling dev_queue_xmit() and
throwing away packets when they're not accepted.
> commit 137742cf9738f1b4784058ff79aec7ca85e769d4
> Author: Karl Hiramoto <karl@hiramoto.org>
> Date: Wed Sep 2 23:26:39 2009 -0700
>
> atm/br2684: netif_stop_queue() when atm device busy and
> netif_wake_queue() when we can send packets again.
Nice work; well done finding that. I've added Karl and DaveM, and the
netdev@ list to Cc.
(Btw, I assume the performance problem also goes away if you use PPPoA?
I've made changes in the PPPoA code recently to *eliminate* excessive
calls to netif_wake_queue(), and also to stop it from filling the ATM
device queue. That was commit 9d02daf7 in 3.5-rc1, which is already in
OpenWRT.)
I was already looking vaguely at how we could limit the PPP queue depth
for PPPoE and implement byte queue limits. Currently the PPP code just
throws the packets at the Ethernet device and considers them 'gone',
which is why it's hitting the ATM limits all the time. The patch you
highlight is changing the behaviour in a case that should never *happen*
with PPP. It's suffering massive queue bloat if it's filling the ATM
queue, and we should fix *that*.
I was looking to see if we could (ab)use the skb->destructor somehow so
that we get *notified* when the packet is actually sent (or dropped),
and then that would allow us to manage the queue 'downstream' of PPP
more sanely. But I haven't really got very far with that yet.
I was planning to find some time to look into it a bit better, and then
send mail to netdev@ asking for more clue. But since you're now falling
over it and it isn't just a theoretical problem, this mail will have to
suffice for now...
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
^ permalink raw reply
* RE: bnx2x: Added EEE support
From: Yuval Mintz @ 2012-06-10 7:47 UTC (permalink / raw)
To: Dan Carpenter; +Cc: netdev@vger.kernel.org
In-Reply-To: <20120608130921.GA19268@elgon.mountain>
> The patch c8c60d88c59c: "bnx2x: Added EEE support" from Jun 6, 2012,
> leads to the following warning:
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:10121
> bnx2x_848x3_config_init()
> error: buffer overflow 'params->req_duplex' 2 <= 4
>
Hi Dan,
You are right - this is indeed an error, although one that shouldn't
affect any existing bnx2x chip supporting EEE.
I'll send a patch correcting it soon.
Thanks,
Yuval
^ permalink raw reply
* Re: [PATCH] virtio-net: fix a race on 32bit arches
From: Michael S. Tsirkin @ 2012-06-10 7:03 UTC (permalink / raw)
To: Rusty Russell
Cc: Eric Dumazet, netdev, linux-kernel, virtualization,
Stephen Hemminger
In-Reply-To: <87ipezhdvx.fsf@rustcorp.com.au>
On Sun, Jun 10, 2012 at 04:06:34PM +0930, Rusty Russell wrote:
> On Wed, 06 Jun 2012 10:45:41 +0200, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > On Wed, 2012-06-06 at 10:35 +0200, Eric Dumazet wrote:
> > > From: Eric Dumazet <edumazet@google.com>
> > >
> > > commit 3fa2a1df909 (virtio-net: per cpu 64 bit stats (v2)) added a race
> > > on 32bit arches.
> > >
> > > We must use separate syncp for rx and tx path as they can be run at the
> > > same time on different cpus. Thus one sequence increment can be lost and
> > > readers spin forever.
> > >
> > > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > > Cc: Stephen Hemminger <shemminger@vyatta.com>
> > > Cc: Michael S. Tsirkin <mst@redhat.com>
> > > Cc: Jason Wang <jasowang@redhat.com>
> > > ---
> >
> > Just to make clear : even using percpu stats/syncp, we have no guarantee
> > that write_seqcount_begin() is done with one instruction. [1]
> >
> > It is OK on x86 if "incl" instruction is generated by the compiler, but
> > on a RISC cpu, the "load memory,%reg ; inc %reg ; store %reg,memory" can
> > be interrupted.
> >
> > So if you are 100% sure all paths are safe against preemption/BH, then
> > this patch is not needed, but a big comment in the code would avoid
> > adding possible races in the future.
>
> Too fragile; let's keep them separate as per this patch.
>
> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
>
> Thanks,
> Rusty.
One question though: do we want to lay the structure
out so that the rx sync structure precedes the rx counters?
--
MST
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 6:47 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120609.220421.2043389435765629622.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Sat, Jun 09, 2012 at 10:04:21PM -0700, David Miller wrote:
> From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Date: Sun, 10 Jun 2012 12:49:34 +0800
>
> > On Sun, Jun 10, 2012 at 12:43:39PM +0800, Fengguang Wu wrote:
> >> On Sat, Jun 09, 2012 at 09:21:47PM -0700, David Miller wrote:
> >> > From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> >> > Date: Sun, 10 Jun 2012 11:16:34 +0800
> >> >
> >> > > In long run, such build-fix patches can also be auto tested and
> >> > > reported, somehow in this way. You just create a temporary branch
> >> >
> >> > Sorry, no.
> >>
> >> That's fine. Then how about including some text "fix build errors" or
> >> "fix build warnings" or paste the original gcc error/warning messages,
> >> somewhere in the changelog or subject?
> >>
> >> That will also allow me recognize that it's a build fix commit and to
> >> make it unconditionally report back any build results.
> >
> > Or better, simply include a
> >
> > Reported-by: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>
> Now that on the other hand I should have done and was an oversight.
That's fine.
Please feel free to add that "Reported-by" to get verbose build report,
as well as to _NOT_ add the above line to avoid receiving reports when
the fix is obviously correct.
Ie. use the tag as a way to control my script.
> But all the other crap, is absolutely unreasonable of you to ask of me.
Yup.. Thanks for your time!
Regards,
Fengguang
^ permalink raw reply
* Re: [PATCH] virtio-net: fix a race on 32bit arches
From: Rusty Russell @ 2012-06-10 6:36 UTC (permalink / raw)
To: Eric Dumazet, Jason Wang
Cc: netdev, Stephen Hemminger, mst, linux-kernel, virtualization
In-Reply-To: <1338972341.2760.3944.camel@edumazet-glaptop>
On Wed, 06 Jun 2012 10:45:41 +0200, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2012-06-06 at 10:35 +0200, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> >
> > commit 3fa2a1df909 (virtio-net: per cpu 64 bit stats (v2)) added a race
> > on 32bit arches.
> >
> > We must use separate syncp for rx and tx path as they can be run at the
> > same time on different cpus. Thus one sequence increment can be lost and
> > readers spin forever.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Stephen Hemminger <shemminger@vyatta.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Jason Wang <jasowang@redhat.com>
> > ---
>
> Just to make clear : even using percpu stats/syncp, we have no guarantee
> that write_seqcount_begin() is done with one instruction. [1]
>
> It is OK on x86 if "incl" instruction is generated by the compiler, but
> on a RISC cpu, the "load memory,%reg ; inc %reg ; store %reg,memory" can
> be interrupted.
>
> So if you are 100% sure all paths are safe against preemption/BH, then
> this patch is not needed, but a big comment in the code would avoid
> adding possible races in the future.
Too fragile; let's keep them separate as per this patch.
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks,
Rusty.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4, 6}/route.c
From: Gao feng @ 2012-06-10 5:14 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
wfg-VuQAYsv1563Yd54FQh9/CA
In-Reply-To: <20120609.190929.1165462964087672866.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
于 2012年06月10日 10:09, David Miller 写道:
> From: Fengguang Wu <wfg@linux.intel.com>
> Date: Sun, 10 Jun 2012 10:08:01 +0800
>
>> And in another config, an old error still triggers:
>>
>> net/ipv4/inetpeer.c: In function ‘family_to_base’:
>> net/ipv4/inetpeer.c:397:50: error: ‘struct net’ has no member named ‘ipv6’
>> net/ipv4/inetpeer.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
>>
>> I'm building this patch on top of net-next master.
>
> What a fucking mess Gao created, I'll fix this.
Ok,I am sorry for these things.
Please just keep cool,If I introduce some messes,I will fix it.
Thanks!
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: David Miller @ 2012-06-10 5:04 UTC (permalink / raw)
To: wfg-VuQAYsv1563Yd54FQh9/CA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120610044934.GA10507@localhost>
From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Date: Sun, 10 Jun 2012 12:49:34 +0800
> On Sun, Jun 10, 2012 at 12:43:39PM +0800, Fengguang Wu wrote:
>> On Sat, Jun 09, 2012 at 09:21:47PM -0700, David Miller wrote:
>> > From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> > Date: Sun, 10 Jun 2012 11:16:34 +0800
>> >
>> > > In long run, such build-fix patches can also be auto tested and
>> > > reported, somehow in this way. You just create a temporary branch
>> >
>> > Sorry, no.
>>
>> That's fine. Then how about including some text "fix build errors" or
>> "fix build warnings" or paste the original gcc error/warning messages,
>> somewhere in the changelog or subject?
>>
>> That will also allow me recognize that it's a build fix commit and to
>> make it unconditionally report back any build results.
>
> Or better, simply include a
>
> Reported-by: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Now that on the other hand I should have done and was an oversight.
But all the other crap, is absolutely unreasonable of you to ask of me.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: David Miller @ 2012-06-10 5:03 UTC (permalink / raw)
To: wfg-VuQAYsv1563Yd54FQh9/CA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120610044339.GA10436@localhost>
From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Date: Sun, 10 Jun 2012 12:43:39 +0800
> That will also allow me recognize that it's a build fix commit and to
> make it unconditionally report back any build results.
How many extra tasks do you want me to add to my already backlogged
workflow?
I'm not doing extra work for you, sorry.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 4:49 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120610044339.GA10436@localhost>
On Sun, Jun 10, 2012 at 12:43:39PM +0800, Fengguang Wu wrote:
> On Sat, Jun 09, 2012 at 09:21:47PM -0700, David Miller wrote:
> > From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > Date: Sun, 10 Jun 2012 11:16:34 +0800
> >
> > > In long run, such build-fix patches can also be auto tested and
> > > reported, somehow in this way. You just create a temporary branch
> >
> > Sorry, no.
>
> That's fine. Then how about including some text "fix build errors" or
> "fix build warnings" or paste the original gcc error/warning messages,
> somewhere in the changelog or subject?
>
> That will also allow me recognize that it's a build fix commit and to
> make it unconditionally report back any build results.
Or better, simply include a
Reported-by: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
line in the commit. Then I can reliably detect that it actually tries
to fix some build error/waring reported by me, and verbosely report
back whether the commit actually fix things up.
Thanks,
Fengguang
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 4:43 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120609.212147.1738198233131370927.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Sat, Jun 09, 2012 at 09:21:47PM -0700, David Miller wrote:
> From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Date: Sun, 10 Jun 2012 11:16:34 +0800
>
> > In long run, such build-fix patches can also be auto tested and
> > reported, somehow in this way. You just create a temporary branch
>
> Sorry, no.
That's fine. Then how about including some text "fix build errors" or
"fix build warnings" or paste the original gcc error/warning messages,
somewhere in the changelog or subject?
That will also allow me recognize that it's a build fix commit and to
make it unconditionally report back any build results.
Thanks,
Fengguang
^ permalink raw reply
* [For..2-6]玛奃 [EndFor]...
From: Vanda Schrum @ 2012-06-10 4:34 UTC (permalink / raw)
To: prmexgrniz520@yahoo.com
瞕胂 驜帀診刨 臗予棜 穣柎 瞃釭陼條 夘 敜嗈楬噬佺 熢 籃殱 輵 绾 鄿褸灎廝 涌眲籆 湏徱垈荝蚉 艢鬪褛憯 奛 汇 摤陯 呸擢...
^ permalink raw reply
* Re: [PATCH torvalds/linux.git] Make linux/tcp.h C++ friendly (trivial)
From: Paul Pluzhnikov @ 2012-06-10 4:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev, jkosina
In-Reply-To: <20120609.212653.1110875247901140795.davem@davemloft.net>
On Sat, Jun 9, 2012 at 9:26 PM, David Miller <davem@davemloft.net> wrote:
> Oh well, II'll edit it up and apply your patch this time.
Thanks. Sorry about the extra work.
> But for future submissions put only essential things into the email
Will do.
Thanks again.
--
Paul Pluzhnikov
^ permalink raw reply
* Re: [PATCH torvalds/linux.git] Make linux/tcp.h C++ friendly (trivial)
From: David Miller @ 2012-06-10 4:26 UTC (permalink / raw)
To: ppluzhnikov; +Cc: netdev, jkosina
In-Reply-To: <20120609145303.3094919060E@elbrus2.mtv.corp.google.com>
From: ppluzhnikov@google.com (Paul Pluzhnikov)
Date: Sat, 9 Jun 2012 07:53:03 -0700 (PDT)
> P.S. Google has blanket copyright assignment to FSF.
FSF assignments have no applicability with the Linux kernel.
This really eliminates the reason why I asked you to make
a fresh submission of the patch.
I asked you to do this so that I could just apply your
patch using "git am --signoff" but I can't, now I have
to edit out all of this irrelevant text you added to
the email.
I have to edit out this "P.S." thing, because it's irrelevant.
I have to edit out all of the trite things like "Thanks," too.
Oh well, II'll edit it up and apply your patch this time.
But for future submissions put only essential things into the email
content because that ends up in the commit message. If you want to
say "extra" stuff say it after the "---" because things said after
"---" don't make it into the commit log message.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: David Miller @ 2012-06-10 4:21 UTC (permalink / raw)
To: wfg-VuQAYsv1563Yd54FQh9/CA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120610031634.GA10032@localhost>
From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Date: Sun, 10 Jun 2012 11:16:34 +0800
> In long run, such build-fix patches can also be auto tested and
> reported, somehow in this way. You just create a temporary branch
Sorry, no.
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 3:16 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, LKML
In-Reply-To: <20120609.190451.182034193302304295.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Sat, Jun 09, 2012 at 07:04:51PM -0700, David Miller wrote:
> From: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Date: Sun, 10 Jun 2012 09:58:32 +0800
>
> > It triggers some warnings:
> >
> > WARNING: net/ipv6/ipv6.o(.text+0x1049c): Section mismatch in reference from the function ip6_route_cleanup() to the variable .init.data:ipv6_inetpeer_ops
>
> This should fix it:
Yes it worked.
Tested-by: Fengguang Wu <wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
In long run, such build-fix patches can also be auto tested and
reported, somehow in this way. You just create a temporary branch
named "0day-XXXXXX" and push the build-fix patch there. After a while
my robot script will pull and build test it. When finished, it will
recognize the "0day" pattern in the branch name and then
*unconditionally* report back.
"unconditionally" means it will
- report build failure as well as build success
- report new error/warnings as well as old ones
Upon receiving the success/failure notification, you can then proceed
to either merge the commit to the main branch, or update the commit in
place to restart the test. This should work much more fluently than
waiting for me to manually test some emailed patch. Not only I may be
sleeping at the time, but also I'm sending out build failure reports
almost *every day*. It would be a burden for me to manually test out
fixes every day...
Thanks,
Fengguang
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: Fengguang Wu @ 2012-06-10 2:37 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
In-Reply-To: <20120609.221801.2226110181753212240.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Sat, Jun 09, 2012 at 10:18:01PM -0400, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Sat, 09 Jun 2012 19:09:29 -0700 (PDT)
>
> > From: Fengguang Wu <wfg@linux.intel.com>
> > Date: Sun, 10 Jun 2012 10:08:01 +0800
> >
> >> And in another config, an old error still triggers:
> >>
> >> net/ipv4/inetpeer.c: In function ‘family_to_base’:
> >> net/ipv4/inetpeer.c:397:50: error: ‘struct net’ has no member named ‘ipv6’
> >> net/ipv4/inetpeer.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
> >>
> >> I'm building this patch on top of net-next master.
> >
> > What a fucking mess Gao created, I'll fix this.
> >
> > Thanks for the report.
>
> I just pushed the following to net-next:
>
> --------------------
> inet: Pass inetpeer root into inet_getpeer*() interfaces.
>
> Otherwise we reference potentially non-existing members when
> ipv6 is disabled.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> include/net/inetpeer.h | 10 +++++-----
> net/ipv4/inetpeer.c | 9 +--------
> net/ipv4/ip_fragment.c | 2 +-
> net/ipv4/route.c | 6 +++---
> net/ipv6/route.c | 2 +-
> 5 files changed, 11 insertions(+), 18 deletions(-)
David,
There will be a delay before I can see and pull the change. But anyway
new build tests should be kicked off automatically after a while.
Any new errors/warnings will be automatically reported to you and the
mailing list. In future build errors in these 4 trees will be CCed to
the netdev mailing list:
netdev@vger.kernel.org git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
netdev@vger.kernel.org git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
netdev@vger.kernel.org git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/isdn-2.6.git
netdev@vger.kernel.org git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git
Thanks,
Fengguang
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: David Miller @ 2012-06-10 2:18 UTC (permalink / raw)
To: wfg-VuQAYsv1563Yd54FQh9/CA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
In-Reply-To: <20120609.190929.1165462964087672866.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
From: David Miller <davem@davemloft.net>
Date: Sat, 09 Jun 2012 19:09:29 -0700 (PDT)
> From: Fengguang Wu <wfg@linux.intel.com>
> Date: Sun, 10 Jun 2012 10:08:01 +0800
>
>> And in another config, an old error still triggers:
>>
>> net/ipv4/inetpeer.c: In function ‘family_to_base’:
>> net/ipv4/inetpeer.c:397:50: error: ‘struct net’ has no member named ‘ipv6’
>> net/ipv4/inetpeer.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
>>
>> I'm building this patch on top of net-next master.
>
> What a fucking mess Gao created, I'll fix this.
>
> Thanks for the report.
I just pushed the following to net-next:
--------------------
inet: Pass inetpeer root into inet_getpeer*() interfaces.
Otherwise we reference potentially non-existing members when
ipv6 is disabled.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/inetpeer.h | 10 +++++-----
net/ipv4/inetpeer.c | 9 +--------
net/ipv4/ip_fragment.c | 2 +-
net/ipv4/route.c | 6 +++---
net/ipv6/route.c | 2 +-
5 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 733edc6..b84b32f 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -83,11 +83,11 @@ static inline bool inet_metrics_new(const struct inet_peer *p)
}
/* can be called with or without local BH being disabled */
-struct inet_peer *inet_getpeer(struct net *net,
+struct inet_peer *inet_getpeer(struct inet_peer_base *base,
const struct inetpeer_addr *daddr,
int create);
-static inline struct inet_peer *inet_getpeer_v4(struct net *net,
+static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
__be32 v4daddr,
int create)
{
@@ -95,10 +95,10 @@ static inline struct inet_peer *inet_getpeer_v4(struct net *net,
daddr.addr.a4 = v4daddr;
daddr.family = AF_INET;
- return inet_getpeer(net, &daddr, create);
+ return inet_getpeer(base, &daddr, create);
}
-static inline struct inet_peer *inet_getpeer_v6(struct net *net,
+static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
const struct in6_addr *v6daddr,
int create)
{
@@ -106,7 +106,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct net *net,
*(struct in6_addr *)daddr.addr.a6 = *v6daddr;
daddr.family = AF_INET6;
- return inet_getpeer(net, &daddr, create);
+ return inet_getpeer(base, &daddr, create);
}
/* can be called from BH context or outside */
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 9d89a38..e4cba56 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -391,12 +391,6 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base,
call_rcu(&p->rcu, inetpeer_free_rcu);
}
-static struct inet_peer_base *family_to_base(struct net *net,
- int family)
-{
- return family == AF_INET ? net->ipv4.peers : net->ipv6.peers;
-}
-
/* perform garbage collect on all items stacked during a lookup */
static int inet_peer_gc(struct inet_peer_base *base,
struct inet_peer __rcu **stack[PEER_MAXDEPTH],
@@ -434,12 +428,11 @@ static int inet_peer_gc(struct inet_peer_base *base,
return cnt;
}
-struct inet_peer *inet_getpeer(struct net *net,
+struct inet_peer *inet_getpeer(struct inet_peer_base *base,
const struct inetpeer_addr *daddr,
int create)
{
struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr;
- struct inet_peer_base *base = family_to_base(net, daddr->family);
struct inet_peer *p;
unsigned int sequence;
int invalidated, gccnt = 0;
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 22c6bab..8d07c97 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -184,7 +184,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, void *a)
qp->daddr = arg->iph->daddr;
qp->user = arg->user;
qp->peer = sysctl_ipfrag_max_dist ?
- inet_getpeer_v4(net, arg->iph->saddr, 1) : NULL;
+ inet_getpeer_v4(net->ipv4.peers, arg->iph->saddr, 1) : NULL;
}
static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cf78343..2aa663a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1328,7 +1328,7 @@ void rt_bind_peer(struct rtable *rt, __be32 daddr, int create)
struct net *net = dev_net(rt->dst.dev);
struct inet_peer *peer;
- peer = inet_getpeer_v4(net, daddr, create);
+ peer = inet_getpeer_v4(net->ipv4.peers, daddr, create);
if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL)
inet_putpeer(peer);
@@ -1684,7 +1684,7 @@ unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
unsigned short est_mtu = 0;
struct inet_peer *peer;
- peer = inet_getpeer_v4(net, iph->daddr, 1);
+ peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1);
if (peer) {
unsigned short mtu = new_mtu;
@@ -1929,7 +1929,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
if (fl4 && (fl4->flowi4_flags & FLOWI_FLAG_PRECOW_METRICS))
create = 1;
- rt->peer = peer = inet_getpeer_v4(net, rt->rt_dst, create);
+ rt->peer = peer = inet_getpeer_v4(net->ipv4.peers, rt->rt_dst, create);
if (peer) {
rt->rt_peer_genid = rt_peer_genid();
if (inet_metrics_new(peer))
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 9586c27..8fc41d5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -306,7 +306,7 @@ void rt6_bind_peer(struct rt6_info *rt, int create)
struct net *net = dev_net(rt->dst.dev);
struct inet_peer *peer;
- peer = inet_getpeer_v6(net, &rt->rt6i_dst.addr, create);
+ peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, create);
if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL)
inet_putpeer(peer);
else
--
1.7.10
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply related
* Re: [PATCH] inet: Initialize per-netns inetpeer roots in net/ipv{4,6}/route.c
From: David Miller @ 2012-06-10 2:09 UTC (permalink / raw)
To: wfg-VuQAYsv1563Yd54FQh9/CA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
In-Reply-To: <20120610020801.GA9293@localhost>
From: Fengguang Wu <wfg@linux.intel.com>
Date: Sun, 10 Jun 2012 10:08:01 +0800
> And in another config, an old error still triggers:
>
> net/ipv4/inetpeer.c: In function ‘family_to_base’:
> net/ipv4/inetpeer.c:397:50: error: ‘struct net’ has no member named ‘ipv6’
> net/ipv4/inetpeer.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
>
> I'm building this patch on top of net-next master.
What a fucking mess Gao created, I'll fix this.
Thanks for the report.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ 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