]> err.no Git - linux-2.6/log
linux-2.6
16 years ago[NETNS]: Add netns refcnt debug for kernel sockets.
Denis V. Lunev [Wed, 16 Apr 2008 08:59:46 +0000 (01:59 -0700)]
[NETNS]: Add netns refcnt debug for kernel sockets.

Protocol control sockets and netlink kernel sockets should not prevent the
namespace stop request. They are initialized and disposed in a special way by
sk_change_net/sk_release_kernel.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETNS]: Make netns refconting debug like a socket one.
Denis V. Lunev [Wed, 16 Apr 2008 08:58:04 +0000 (01:58 -0700)]
[NETNS]: Make netns refconting debug like a socket one.

Make release_net/hold_net noop for performance-hungry people. This is a debug
staff and should be used in the debug mode only.

Add check for net != NULL in hold/release calls. This will be required
later on.

[ Added minor simplifications suggested by Brian Haley. -DaveM ]

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Allow to create IP6 tunnels in net namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:24:13 +0000 (01:24 -0700)]
[IP6TUNNEL]: Allow to create IP6 tunnels in net namespaces.

And no need in some IPPROTO_XXX enabling, since ipv6 code
doesn't have any filtering.

So, just set proper net and mark device with NETNS_LOCAL.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Use proper net instead of init_net stubs.
Pavel Emelyanov [Wed, 16 Apr 2008 08:23:44 +0000 (01:23 -0700)]
[IP6TUNNEL]: Use proper net instead of init_net stubs.

All the ip_route_output_key(), dev_get_by_...() and ipv6_chk_addr()
calls are now stubbed with init_net.

Fortunately, all the places already have where to get the proper
net from.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Make tunnels hashes per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:23:22 +0000 (01:23 -0700)]
[IP6TUNNEL]: Make tunnels hashes per-net.

Move hashes in the struct ip6_tnl_net, replace tnls_xxx[] with
ip6n->tnlx_xxx[] and handle init and exit appropriately.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Make the fallback tunnel device per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:23:02 +0000 (01:23 -0700)]
[IP6TUNNEL]: Make the fallback tunnel device per-net.

All the code, that reference it already has the ip6_tnl_net pointer,
so s/ip6_fb_tnl_dev/ip6n->fb_tnl_dev/ and move creation/releasing
code into net init/exit ops.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Use proper net in hash-lookup functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:22:43 +0000 (01:22 -0700)]
[IP6TUNNEL]: Use proper net in hash-lookup functions.

Calls to ip6_tnl_lookup were stubbed with init_net - give them
a proper one.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Add (ip6_tnl_)net argument to some calls.
Pavel Emelyanov [Wed, 16 Apr 2008 08:22:23 +0000 (01:22 -0700)]
[IP6TUNNEL]: Add (ip6_tnl_)net argument to some calls.

Hashes and fallback device used in them will be per-net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IP6TUNNEL]: Introduce empty ip6_tnl_net structure and net ops.
Pavel Emelyanov [Wed, 16 Apr 2008 08:22:02 +0000 (01:22 -0700)]
[IP6TUNNEL]: Introduce empty ip6_tnl_net structure and net ops.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Allow for IPPROTO_IPV6 protocol in namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:17:39 +0000 (01:17 -0700)]
[SIT]: Allow for IPPROTO_IPV6 protocol in namespaces.

This makes sit-generated traffic enter the namespace.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Allow to create SIT tunnels in net namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:17:18 +0000 (01:17 -0700)]
[SIT]: Allow to create SIT tunnels in net namespaces.

Set proper net and mark a new device as NETNS_LOCAL before registering.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Use proper net in routing calls.
Pavel Emelyanov [Wed, 16 Apr 2008 08:16:58 +0000 (01:16 -0700)]
[SIT]: Use proper net in routing calls.

I.e. replace init_net stubs in ip_route_output_key() calls.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Make tunnels hashes per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:16:38 +0000 (01:16 -0700)]
[SIT]: Make tunnels hashes per-net.

Just move all the hashes on the sit_net structure and
patch the rest of the code appropriately.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Make the fallback tunnel device per-net
Pavel Emelyanov [Wed, 16 Apr 2008 08:16:18 +0000 (01:16 -0700)]
[SIT]: Make the fallback tunnel device per-net

Allocate and register one in sit_init_net, use sitn->fb_tunnel_dev
over the code and unregister one in sit_exit_net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Use proper net in hash-lookup functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:15:59 +0000 (01:15 -0700)]
[SIT]: Use proper net in hash-lookup functions.

Replace introduced in the previous patch init_net stubs
with the proper net pointer.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Add net/sit_net argument to some functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:15:39 +0000 (01:15 -0700)]
[SIT]: Add net/sit_net argument to some functions.

... to make them prepared for future hashes and fallback device
move on the struct sit_net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SIT]: Introduce empty struct sit_net and init/exit net ops.
Pavel Emelyanov [Wed, 16 Apr 2008 08:15:17 +0000 (01:15 -0700)]
[SIT]: Introduce empty struct sit_net and init/exit net ops.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Allow for IPPROTO_GRE protocol in namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:11:36 +0000 (01:11 -0700)]
[GRE]: Allow for IPPROTO_GRE protocol in namespaces.

This one was also disabled by default for sanity.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Allow to create IPGRE tunnels in net namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:11:13 +0000 (01:11 -0700)]
[GRE]: Allow to create IPGRE tunnels in net namespaces.

I.e. set the proper net and mark as NETNS_LOCAL.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Use proper net in routing calls.
Pavel Emelyanov [Wed, 16 Apr 2008 08:10:44 +0000 (01:10 -0700)]
[GRE]: Use proper net in routing calls.

As for the IPIP tunnel, there are some ip_route_output_key()
calls in there that require a proper net so give one to them.

And a proper net for the __get_dev_by_index hanging around.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Make tunnels hashes per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:10:26 +0000 (01:10 -0700)]
[GRE]: Make tunnels hashes per-net.

Very similar to what was done for the IPIP code.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Make the fallback tunnel device per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:10:05 +0000 (01:10 -0700)]
[GRE]: Make the fallback tunnel device per-net.

Everything is prepared for this change now. Create on in
init callback, use it over the code and destroy on net exit.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Use proper net in hash-lookup functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:09:44 +0000 (01:09 -0700)]
[GRE]: Use proper net in hash-lookup functions.

This is the part#2 of the patch #2 - get the proper net for
these functions. This change in a separate patch in order not
to get lost in a large previous patch.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Add net/gre_net argument to some functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:09:22 +0000 (01:09 -0700)]
[GRE]: Add net/gre_net argument to some functions.

The fallback device and hashes are to become per-net, but many
code doesn't have anything to get the struct net pointer from.

So pass the proper net there with an extra argument.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[GRE]: Introduce empty ipgre_net structure and net init/exit ops.
Pavel Emelyanov [Wed, 16 Apr 2008 08:08:53 +0000 (01:08 -0700)]
[GRE]: Introduce empty ipgre_net structure and net init/exit ops.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Allow for IPPROTO_IPIP protocol in namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:06:56 +0000 (01:06 -0700)]
[IPIP]: Allow for IPPROTO_IPIP protocol in namespaces.

This one was disabled by default for sanity.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Allow to create IPIP tunnels in net namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 08:06:18 +0000 (01:06 -0700)]
[IPIP]: Allow to create IPIP tunnels in net namespaces.

Set the proper net before calling register_netdev and disable
the tunnel device netns changing.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Use proper net in (mostly) routing calls.
Pavel Emelyanov [Wed, 16 Apr 2008 08:05:57 +0000 (01:05 -0700)]
[IPIP]: Use proper net in (mostly) routing calls.

There are some ip_route_output_key() calls in there that require
a proper net so give one to them.

Besides - give a proper net to a single __get_dev_by_index call
in ipip_tunnel_bind_dev().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Make tunnels hashes per net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:05:32 +0000 (01:05 -0700)]
[IPIP]: Make tunnels hashes per net.

Either net or ipip_net already exists in all the required
places, so just use one.

Besides, tune net_init and net_exit calls to respectively
initialize the hashes and destroy devices.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Use proper net in hash-lookup functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:05:03 +0000 (01:05 -0700)]
[IPIP]: Use proper net in hash-lookup functions.

This is the part#2 of the previous patch - get the proper
net for these functions.

I make it in a separate patch, so that this change does not
get lost in a large previous patch.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Add net/ipip_net argument to some functions.
Pavel Emelyanov [Wed, 16 Apr 2008 08:04:35 +0000 (01:04 -0700)]
[IPIP]: Add net/ipip_net argument to some functions.

The hashes of tunnels will be per-net too, so prepare all the
functions that uses them for this change by adding an argument.

Use init_net temporarily in places, where the net does not exist
explicitly yet.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Make the fallback tunnel device per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 08:04:13 +0000 (01:04 -0700)]
[IPIP]: Make the fallback tunnel device per-net.

Create on in ipip_init_net(), use it all over the code (the
proper place to get the net from already exists) and destroy
in ipip_net_exit().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPIP]: Introduce empty ipip_net structure and net init/exit ops.
Pavel Emelyanov [Wed, 16 Apr 2008 08:03:13 +0000 (01:03 -0700)]
[IPIP]: Introduce empty ipip_net structure and net init/exit ops.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Handle vlan devices net namespace changing.
Pavel Emelyanov [Wed, 16 Apr 2008 07:57:01 +0000 (00:57 -0700)]
[VLAN]: Handle vlan devices net namespace changing.

When van device is moved to another namespace proc files,
related to this device, should also change one.

Use the netdev REGISTER and UNREGISTER event handlers for this.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Allow vlan devices registration in net namespaces.
Pavel Emelyanov [Wed, 16 Apr 2008 07:55:06 +0000 (00:55 -0700)]
[VLAN]: Allow vlan devices registration in net namespaces.

This one is similar to what I've done for TUN - set the proper
net after device allocation and clean VLANs on net exit (use the
rtnl_kill_links helper finally).

Plus, drop explicit init_net usage and net != &init_net checks.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Make the vlan_name_type per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 07:54:39 +0000 (00:54 -0700)]
[VLAN]: Make the vlan_name_type per-net.

This includes moving one on the struct vlan_net and
s/vlan_name_type/vn->name_type/ over the code.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Make the /proc/net/vlan/conf file show per-net info.
Pavel Emelyanov [Wed, 16 Apr 2008 07:52:24 +0000 (00:52 -0700)]
[VLAN]: Make the /proc/net/vlan/conf file show per-net info.

It is created in a proper net, so make is show info, related
to this particular net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Create proc entries in the proper net.
Pavel Emelyanov [Wed, 16 Apr 2008 07:51:51 +0000 (00:51 -0700)]
[VLAN]: Create proc entries in the proper net.

The proc_vlan_dir and proc_vlan_conf migrate on the struct
vlan_net and their creation uses the struct net.

The devices' entries use the corresponding device's net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Add a net argument to proc init and cleanup calls.
Pavel Emelyanov [Wed, 16 Apr 2008 07:51:12 +0000 (00:51 -0700)]
[VLAN]: Add a net argument to proc init and cleanup calls.

All proc files will be created in each net, so prepare them for
this change now, not to mess it with real creation patch.

The net != &init_net checks in them are for git-bisect sanity,
but I will drop them soon.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Introduce the vlan_net structure and init/exit net ops.
Pavel Emelyanov [Wed, 16 Apr 2008 07:49:09 +0000 (00:49 -0700)]
[VLAN]: Introduce the vlan_net structure and init/exit net ops.

Unlike TUN, it is empty from the very beginning, and will
be eventually populated later.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[VLAN]: Tag vlan_group_device with net device, not ifindex.
Pavel Emelyanov [Wed, 16 Apr 2008 07:48:04 +0000 (00:48 -0700)]
[VLAN]: Tag vlan_group_device with net device, not ifindex.

Currently vlan group is searched using one key - the ifindex.
We'll have to lookup the vlan_group by two keys - ifindex and
net. Turning the vlan_group lookup key to struct net_device
pointer will make this process easier.

Besides, this will eliminate one more place in the networking,
that assumes that indexes are unique in the kernel.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[RTNL]: Introduce the rtnl_kill_links helper.
Pavel Emelyanov [Wed, 16 Apr 2008 07:46:52 +0000 (00:46 -0700)]
[RTNL]: Introduce the rtnl_kill_links helper.

This one is responsible for calling ->dellink on each net
device found in net to help with vlan net_exit hook in the
nearest future.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[RTNL]: Relax for_each_netdev_safe in __rtnl_link_unregister.
Pavel Emelyanov [Wed, 16 Apr 2008 07:45:56 +0000 (00:45 -0700)]
[RTNL]: Relax for_each_netdev_safe in __rtnl_link_unregister.

Each potential list_del (happening from inside a ->dellink call)
is followed by goto restart, so there's no need in _safe iteration.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TUN]: Allow to register tun devices in namespace.
Pavel Emelyanov [Wed, 16 Apr 2008 07:41:53 +0000 (00:41 -0700)]
[TUN]: Allow to register tun devices in namespace.

This is basically means that a net is set for a new device, but
actually also involves two more steps:

1. mark the tun device as "local", i.e. do not allow for it to
   move across namespaces.

This is done so, since tun device is most often associated to some
file (and thus to some process) and moving the device alone is not
valid while keeping the file and the process outside. The need in
ability to move a detached persistent device is to be investigated
later.

2. get the tun device's net when tun becomes attached and put one
   when it becomes detached.

This is needed to handle the case when a task owning the tun dies,
but a files lives for some more time - in this case we must not
allow for net to be freed, since its exit hook will spoil that file's
private data by unregistering the tun from under tun_chr_close.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TUN]: Make the tun_dev_list per-net.
Pavel Emelyanov [Wed, 16 Apr 2008 07:41:16 +0000 (00:41 -0700)]
[TUN]: Make the tun_dev_list per-net.

Remove the static tun_dev_list and replace its occurrences in
driver with per-net one.

It is used in two places - in tun_set_iff and tun_cleanup. In
the first case it's legal to use current net_ns. In the cleanup
call - move the loop, that unregisters all devices in net exit
hook.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TUN]: Introduce the tun_net structure and init/exit net ops.
Pavel Emelyanov [Wed, 16 Apr 2008 07:40:46 +0000 (00:40 -0700)]
[TUN]: Introduce the tun_net structure and init/exit net ops.

This is the first step in making tuntap devices work in net
namespaces. The structure mentioned is pointed by generic
net pointer with tun_net_id id, and tun driver fills one on
its load. It will contain only the tun devices list.

So declare this structure and introduce net init and exit hooks.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TCP]: Remove superflushious skb == write_queue_tail() check
Ilpo Järvinen [Wed, 16 Apr 2008 03:36:55 +0000 (20:36 -0700)]
[TCP]: Remove superflushious skb == write_queue_tail() check

Needed can only be more strict than what was checked by the
earlier common case check for non-tail skbs, thus
cwnd_len <= needed will never match in that case anyway.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[ETHTOOL]: Add support for large eeproms
Mandeep Singh Baines [Wed, 16 Apr 2008 02:24:17 +0000 (19:24 -0700)]
[ETHTOOL]: Add support for large eeproms

Currently, it is not possible to read/write to an eeprom larger than
128k in size because the buffer used for temporarily storing the
eeprom contents is allocated using kmalloc. kmalloc can only allocate
a maximum of 128k depending on architecture.

Modified ethtool_get/set_eeprom to only allocate a page of memory and
then copy the eeprom a page at a time.

Updated original patch as per suggestions from Joe Perches.

Signed-off-by: Mandeep Singh Baines <msb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoCAN: use hrtimers in can-bcm protocol
Oliver Hartkopp [Wed, 16 Apr 2008 02:29:14 +0000 (19:29 -0700)]
CAN: use hrtimers in can-bcm protocol

Make use of hrtimers to support high resolution capabilities, when
provided by the system clocksource.

The conversion to hrtimers additionally discovered and solved an
unlikely race condition that has been reproduced under (unrealistic)
massive receive load, which can only be produced on vcan software devices.

[ Fix printf format warnings on 64-bit -DaveM ]

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Enhance validation of format on incoming messages
Allan Stephens [Wed, 16 Apr 2008 02:04:54 +0000 (19:04 -0700)]
[TIPC]: Enhance validation of format on incoming messages

This patch ensures that TIPC properly handles incoming messages
that have incorrect or unexpected formats.  Most significantly,
it now ensures that each sl_buff has at least as much data as
the message header indicates it should, and that the entire
message header is stored contiguously; this prevents TIPC from
accidentally accessing memory that is not part of the sk_buff.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Force linearization of non-linear sk_buffs
Allan Stephens [Wed, 16 Apr 2008 02:03:23 +0000 (19:03 -0700)]
[TIPC]: Force linearization of non-linear sk_buffs

This patch allows TIPC to process incoming messages that are
stored in a fragmented sk_buff, by forcing the linearization
of any such messages it receives.

Note: This is an interim solution to allow TIPC to operate with
Ethernet devices that generate non-linear buffers (such as the
gianfar driver), until such time as the rest of TIPC is enhanced
to handle sk_buffs with multiple data areas.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Use fast buffer cloning to improve performance
Allan Stephens [Wed, 16 Apr 2008 02:02:30 +0000 (19:02 -0700)]
[TIPC]: Use fast buffer cloning to improve performance

This patch causes TIPC to allocate fast clonable sk_buffs,
rather than standard ones.  This speeds up the cloning
operation done by the link code each time a message is sent
off-node.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Remove redundant NULL check when discarding buffers
Allan Stephens [Wed, 16 Apr 2008 02:01:43 +0000 (19:01 -0700)]
[TIPC]: Remove redundant NULL check when discarding buffers

This patch eliminates a null pointer check when discarding a
TIPC message buffer, since kfree_skb() already handles this
situation.

Acknowledgements to Florian Westphal (fw@strlen.de> for
suggesting this enhancement.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETNS]: The generic per-net pointers.
Pavel Emelyanov [Tue, 15 Apr 2008 07:36:08 +0000 (00:36 -0700)]
[NETNS]: The generic per-net pointers.

Add the elastic array of void * pointer to the struct net.
The access rules are simple:

 1. register the ops with register_pernet_gen_device to get
    the id of your private pointer
 2. call net_assign_generic() to put the private data on the
    struct net (most preferably this should be done in the
    ->init callback of the ops registered)
 3. do not store any private reference on the net_generic array;
 4. do not change this pointer while the net is alive;
 5. use the net_generic() to get the pointer.

When adding a new pointer, I copy the old array, replace it
with a new one and schedule the old for kfree after an RCU
grace period.

Since the net_generic explores the net->gen array inside rcu
read section and once set the net->gen->ptr[x] pointer never
changes, this grants us a safe access to generic pointers.

Quoting Paul: "... RCU is protecting -only- the net_generic
structure that net_generic() is traversing, and the [pointer]
returned by net_generic() is protected by a reference counter
in the upper-level struct net."

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETNS]: The net-subsys IDs generator.
Pavel Emelyanov [Tue, 15 Apr 2008 07:35:23 +0000 (00:35 -0700)]
[NETNS]: The net-subsys IDs generator.

To make some per-net generic pointers, we need some way to address
them, i.e. - IDs. This is simple IDA-based IDs generator for pernet
subsystems.

Addressing questions about potential checkpoint/restart problems:
these IDs are "lite-offsets" within the net structure and are by no
means supposed to be exported to the userspace.

Since it will be used in the nearest future by devices only (tun,
vlan, tunnels, bridge, etc), I make it resemble the functionality
of register_pernet_device().

The new ids is stored in the *id pointer _before_ calling the init
callback to make this id available in this callback.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[ISDN] include/linux/isdn.h: remove dead code
Adrian Bunk [Tue, 15 Apr 2008 07:30:16 +0000 (00:30 -0700)]
[ISDN] include/linux/isdn.h: remove dead code

This patch remove the usage of a nonexisting kconfig variable.

Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IRDA]: Remove irlan_eth_send_gratuitous_arp()
Adrian Bunk [Tue, 15 Apr 2008 07:29:24 +0000 (00:29 -0700)]
[IRDA]: Remove irlan_eth_send_gratuitous_arp()

Even kernel 2.2.26 (sic) already contains the
  #undef CONFIG_IRLAN_SEND_GRATUITOUS_ARP
with the comment "but for some reason the machine crashes if you use DHCP".

Either someone finally looks into this or it's simply time to remove
this dead code.

Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[WANPIPE]: Forgotten bits of Sangoma drivers removal.
Adrian Bunk [Tue, 15 Apr 2008 07:27:58 +0000 (00:27 -0700)]
[WANPIPE]: Forgotten bits of Sangoma drivers removal.

Robert P. J. Day spotted that my removal of the Sangoma drivers missed
a few bits.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Overhaul of socket locking logic
Allan Stephens [Tue, 15 Apr 2008 07:22:02 +0000 (00:22 -0700)]
[TIPC]: Overhaul of socket locking logic

This patch modifies TIPC's socket code to follow the same approach
used by other protocols.  This change eliminates the need for a
mutex in the TIPC-specific portion of the socket protocol data
structure -- in its place, the standard Linux socket backlog queue
and associated locking routines are utilized.  These changes fix
a long-standing receive queue bug on SMP systems, and also enable
individual read and write threads to utilize a socket without
unnecessarily interfering with each other.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Cosmetic changes to TIPC connect() code
Allan Stephens [Tue, 15 Apr 2008 07:20:37 +0000 (00:20 -0700)]
[TIPC]: Cosmetic changes to TIPC connect() code

This patch fixes TIPC's connect routine to conform to Linux
kernel style norms of indentation, line length, etc.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Add error check to detect non-blocking form of connect()
Allan Stephens [Tue, 15 Apr 2008 07:16:19 +0000 (00:16 -0700)]
[TIPC]: Add error check to detect non-blocking form of connect()

This patch causes TIPC to return an error indication if the non-
blocking form of connect() is requested (which TIPC does not yet
support).

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Correct "off by 1" error in socket queue limit enforcement
Allan Stephens [Tue, 15 Apr 2008 07:15:50 +0000 (00:15 -0700)]
[TIPC]: Correct "off by 1" error in socket queue limit enforcement

This patch fixes a bug that allowed TIPC to queue 1 more message
than allowed by the socket receive queue threshold limits.  The
patch also improves the threshold code's logic and naming to help
prevent this sort of error from recurring in the future.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Ignore message padding when receiving stream data
Allan Stephens [Tue, 15 Apr 2008 07:15:15 +0000 (00:15 -0700)]
[TIPC]: Ignore message padding when receiving stream data

This patch ensures that padding bytes appearing at the end of
an incoming TIPC message are not returned as valid stream data.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Allow stream receive to read from multiple TIPC messages
Allan Stephens [Tue, 15 Apr 2008 07:07:15 +0000 (00:07 -0700)]
[TIPC]: Allow stream receive to read from multiple TIPC messages

This patch allows a stream socket to receive data from multiple
TIPC messages in its receive queue, without requiring the use of
the MSG_WAITALL flag.

Acknowledgements to Florian Westphal <fw-tipc@strlen.de> for
identifying this issue and suggesting how to correct it.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TIPC]: Skip connection flow control in connectionless sockets
Allan Stephens [Tue, 15 Apr 2008 07:06:12 +0000 (00:06 -0700)]
[TIPC]: Skip connection flow control in connectionless sockets

This patch optimizes the receive path for SOCK_DGRAM and SOCK_RDM
messages by skipping over code that handles connection-based flow
control.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[XFRM]: Compilation warnings in xfrm_user.c.
Denis V. Lunev [Mon, 14 Apr 2008 21:47:48 +0000 (14:47 -0700)]
[XFRM]: Compilation warnings in xfrm_user.c.

When CONFIG_SECURITY_NETWORK_XFRM is undefined the following warnings appears:
net/xfrm/xfrm_user.c: In function 'xfrm_add_pol_expire':
net/xfrm/xfrm_user.c:1576: warning: 'ctx' may be used uninitialized in this function
net/xfrm/xfrm_user.c: In function 'xfrm_get_policy':
net/xfrm/xfrm_user.c:1340: warning: 'ctx' may be used uninitialized in this function
(security_xfrm_policy_alloc is noop for the case).

It seems that they are result of the commit
03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b ("LSM: Make the Labeled IPsec
hooks more stack friendly")

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TCP]: Format addresses appropriately in debug messages.
YOSHIFUJI Hideaki [Mon, 14 Apr 2008 11:09:36 +0000 (04:09 -0700)]
[TCP]: Format addresses appropriately in debug messages.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[IPV4]: Use NIPQUAD_FMT to format ipv4 addresses.
YOSHIFUJI Hideaki [Mon, 14 Apr 2008 11:09:00 +0000 (04:09 -0700)]
[IPV4]: Use NIPQUAD_FMT to format ipv4 addresses.

And use %u to format port.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2...
David S. Miller [Mon, 14 Apr 2008 10:50:43 +0000 (03:50 -0700)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.26

16 years ago[SOCK]: Add some notes about per-bind-bucket sock lookup.
Pavel Emelyanov [Mon, 14 Apr 2008 09:42:27 +0000 (02:42 -0700)]
[SOCK]: Add some notes about per-bind-bucket sock lookup.

I was asked about "why don't we perform a sk_net filtering in
bind_conflict calls, like we do in other sock lookup places"
for a couple of times.

Can we please add a comment about why we do not need one?

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[DCCP]: Fix comment about control sockets.
Pavel Emelyanov [Mon, 14 Apr 2008 09:38:45 +0000 (02:38 -0700)]
[DCCP]: Fix comment about control sockets.

These sockets now have a bit other names and are no longer global.

Shame on me, I haven't provided a good comment for this when
sending DCCP netnsization patches.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Mon, 14 Apr 2008 09:30:23 +0000 (02:30 -0700)]
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

Conflicts:

drivers/net/ehea/ehea_main.c
drivers/net/wireless/iwlwifi/Kconfig
drivers/net/wireless/rt2x00/rt61pci.c
net/ipv4/inet_timewait_sock.c
net/ipv6/raw.c
net/mac80211/ieee80211_sta.c

16 years ago[NETFILTER]: nf_conntrack: fix incorrect check for expectations
Patrick McHardy [Mon, 14 Apr 2008 09:21:01 +0000 (11:21 +0200)]
[NETFILTER]: nf_conntrack: fix incorrect check for expectations

The expectation classes changed help->expectations to an array,
fix use as scalar value.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: bridge: add ebt_nflog watcher
Peter Warasin [Mon, 14 Apr 2008 09:15:54 +0000 (11:15 +0200)]
[NETFILTER]: bridge: add ebt_nflog watcher

This patch adds the ebtables nflog watcher to the kernel in order to
allow ebtables log through the nfnetlink_log backend.

Signed-off-by: Peter Warasin <peter@endian.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: replace NF_CT_DUMP_TUPLE macro indrection by function...
Jan Engelhardt [Mon, 14 Apr 2008 09:15:54 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: replace NF_CT_DUMP_TUPLE macro indrection by function call

Directly call IPv4 and IPv6 variants where the address family is
easily known.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: const annotations in nf_conntrack_sctp, nf_nat_proto_gre
Jan Engelhardt [Mon, 14 Apr 2008 09:15:54 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: const annotations in nf_conntrack_sctp, nf_nat_proto_gre

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: use bool type in nf_nat_proto
Jan Engelhardt [Mon, 14 Apr 2008 09:15:53 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: use bool type in nf_nat_proto

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_tuple.h
Jan Engelhardt [Mon, 14 Apr 2008 09:15:53 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_tuple.h

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l4proto
Jan Engelhardt [Mon, 14 Apr 2008 09:15:53 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l4proto

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l3proto
Jan Engelhardt [Mon, 14 Apr 2008 09:15:52 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l3proto

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: Remove unused callbacks in nf_conntrack_l3proto
Jan Engelhardt [Mon, 14 Apr 2008 09:15:52 +0000 (11:15 +0200)]
[NETFILTER]: Remove unused callbacks in nf_conntrack_l3proto

These functions are never called.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: add tuplehash l3num/protonum accessors
Patrick McHardy [Mon, 14 Apr 2008 09:15:52 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack: add tuplehash l3num/protonum accessors

Add accessors for l3num and protonum and get rid of some overly long
expressions.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack_tcp: catch invalid state updates over ctnetlink
Patrick McHardy [Mon, 14 Apr 2008 09:15:52 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack_tcp: catch invalid state updates over ctnetlink

Invalid states can cause out-of-bound memory accesses of the state table.
Also don't insist on having a new state contained in the netlink message.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: kill helper and seq_adjust hooks
Patrick McHardy [Mon, 14 Apr 2008 09:15:52 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: kill helper and seq_adjust hooks

Connection tracking helpers (specifically FTP) need to be called
before NAT sequence numbers adjustments are performed to be able
to compare them against previously seen ones. We've introduced
two new hooks around 2.6.11 to maintain this ordering when NAT
modules were changed to get called from conntrack helpers directly.

The cost of netfilter hooks is quite high and sequence number
adjustments are only rarely needed however. Add a RCU-protected
sequence number adjustment function pointer and call it from
IPv4 conntrack after calling the helper.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack_extend: warn on confirmed conntracks
Patrick McHardy [Mon, 14 Apr 2008 09:15:51 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack_extend: warn on confirmed conntracks

New extensions may only be added to unconfirmed conntracks to avoid races
when reallocating the storage.

Also change NF_CT_ASSERT to use WARN_ON to get backtraces.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: don't add NAT extension for confirmed conntracks
Patrick McHardy [Mon, 14 Apr 2008 09:15:51 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: don't add NAT extension for confirmed conntracks

Adding extensions to confirmed conntracks is not allowed to avoid races
on reallocation. Don't setup NAT for confirmed conntracks in case NAT
module is loaded late.

The has one side-effect, the connections existing before the NAT module
was loaded won't enter the bysource hash. The only case where this actually
makes a difference is in case of SNAT to a multirange where the IP before
NAT is also part of the range. Since old connections don't enter the
bysource hash the first new connection from the IP will have a new address
selected. This shouldn't matter at all.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: remove obsolete check for ICMP redirects
Patrick McHardy [Mon, 14 Apr 2008 09:15:50 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: remove obsolete check for ICMP redirects

Locally generated ICMP packets have a reference to the conntrack entry
of the original packet manually attached by icmp_send(). Therefore the
check for locally originated untracked ICMP redirects can never be
true.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: add SCTP protocol support
Patrick McHardy [Mon, 14 Apr 2008 09:15:50 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: add SCTP protocol support

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: add DCCP protocol support
Patrick McHardy [Thu, 20 Mar 2008 14:15:57 +0000 (15:15 +0100)]
[NETFILTER]: nf_nat: add DCCP protocol support

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack: add DCCP protocol support
Patrick McHardy [Thu, 20 Mar 2008 14:15:55 +0000 (15:15 +0100)]
[NETFILTER]: nf_conntrack: add DCCP protocol support

Add DCCP conntrack helper. Thanks to Gerrit Renker <gerrit@erg.abdn.ac.uk>
for review and testing.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: Add partial checksum validation helper
Patrick McHardy [Thu, 20 Mar 2008 14:15:53 +0000 (15:15 +0100)]
[NETFILTER]: Add partial checksum validation helper

Move the UDP-Lite conntrack checksum validation to a generic helper
similar to nf_checksum() and make it fall back to nf_checksum()
in case the full packet is to be checksummed and hardware checksums
are available. This is to be used by DCCP conntrack, which also
needs to verify partial checksums.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: add UDP-Lite support
Patrick McHardy [Thu, 20 Mar 2008 14:15:51 +0000 (15:15 +0100)]
[NETFILTER]: nf_nat: add UDP-Lite support

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: remove unused name from struct nf_nat_protocol
Patrick McHardy [Thu, 20 Mar 2008 14:15:49 +0000 (15:15 +0100)]
[NETFILTER]: nf_nat: remove unused name from struct nf_nat_protocol

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack_netlink: clean up NAT protocol parsing
Patrick McHardy [Mon, 14 Apr 2008 09:15:47 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack_netlink: clean up NAT protocol parsing

Move responsibility for setting the IP_NAT_RANGE_PROTO_SPECIFIED flag
to the NAT protocol, properly propagate errors and get rid of ugly
return value convention.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: move NAT ctnetlink helpers to nf_nat_proto_common
Patrick McHardy [Mon, 14 Apr 2008 09:15:47 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: move NAT ctnetlink helpers to nf_nat_proto_common

Move to nf_nat_proto_common and rename to nf_nat_proto_... since they're
also used by protocols that don't have port numbers.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: fix random mode not to overwrite port rover
Patrick McHardy [Mon, 14 Apr 2008 09:15:46 +0000 (11:15 +0200)]
[NETFILTER]: nf_nat: fix random mode not to overwrite port rover

The port rover should not get overwritten when using random mode,
otherwise other rules will also use more or less random ports.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_nat: add helpers for common NAT protocol operations
Patrick McHardy [Thu, 20 Mar 2008 14:15:47 +0000 (15:15 +0100)]
[NETFILTER]: nf_nat: add helpers for common NAT protocol operations

Add generic ->in_range and ->unique_tuple ops to avoid duplicating them
again and again for future NAT modules and save a few bytes of text:

net/ipv4/netfilter/nf_nat_proto_tcp.c:
  tcp_in_range     |  -62 (removed)
  tcp_unique_tuple | -259 # 271 -> 12, # inlines: 1 -> 0, size inlines: 7 -> 0
 2 functions changed, 321 bytes removed

net/ipv4/netfilter/nf_nat_proto_udp.c:
  udp_in_range     |  -62 (removed)
  udp_unique_tuple | -259 # 271 -> 12, # inlines: 1 -> 0, size inlines: 7 -> 0
 2 functions changed, 321 bytes removed

net/ipv4/netfilter/nf_nat_proto_gre.c:
  gre_in_range |  -62 (removed)
 1 function changed, 62 bytes removed

vmlinux:
 5 functions changed, 704 bytes removed

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: {ip,ip6,arp}_tables: return EAGAIN for invalid SO_GET_ENTRIES size
Patrick McHardy [Mon, 14 Apr 2008 09:15:45 +0000 (11:15 +0200)]
[NETFILTER]: {ip,ip6,arp}_tables: return EAGAIN for invalid SO_GET_ENTRIES size

Rule dumping is performed in two steps: first userspace gets the
ruleset size using getsockopt(SO_GET_INFO) and allocates memory,
then it calls getsockopt(SO_GET_ENTRIES) to actually dump the
ruleset. When another process changes the ruleset in between the
sizes from the first getsockopt call doesn't match anymore and
the kernel aborts. Unfortunately it returns EAGAIN, as for multiple
other possible errors, so userspace can't distinguish this case
from real errors.

Return EAGAIN so userspace can retry the operation.

Fixes (with current iptables SVN version) netfilter bugzilla #104.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: nf_conntrack_sip: clear address in parse_addr()
Patrick McHardy [Mon, 14 Apr 2008 09:15:45 +0000 (11:15 +0200)]
[NETFILTER]: nf_conntrack_sip: clear address in parse_addr()

Some callers pass uninitialized structures, clear the address to make
sure later comparisions work properly.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years ago[NETFILTER]: Explicitly initialize .priority in arptable_filter
Jan Engelhardt [Mon, 14 Apr 2008 09:15:44 +0000 (11:15 +0200)]
[NETFILTER]: Explicitly initialize .priority in arptable_filter

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>