lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <49146265.8040301@cosmosbay.com>
Date:	Fri, 07 Nov 2008 16:44:37 +0100
From:	Eric Dumazet <dada1@...mosbay.com>
To:	"David S. Miller" <davem@...emloft.net>
CC:	Linux Netdev List <netdev@...r.kernel.org>,
	Patrick McHardy <kaber@...sh.net>
Subject: [PATCH] net: introduce read_pnet() and write_pnet() functions

CONFIG_NET_NS is not a widespread option, we can reduce kernel size
not declaring useless "struct net" pointers in several structures.

This patch declares three helper to clean various "ifdef CONFIG_NET_NS"
that we have in many places.

#ifdef CONFIG_NET_NS

#define DECLARE_PNET(name) struct net *name;
static inline void write_pnet(struct net **pnet, struct net *net)
{
        *pnet = net;
}

static inline struct net *read_pnet(struct net * const *pnet)
{
        return *pnet;
}
#else

#define DECLARE_PNET(name)
#define write_pnet(pnet, net)   do { (void)(net);} while (0)
#define read_pnet(pnet)         (&init_net)

#endif

In particular, using these helpers permits a shrink of inet_bind_bucket
(16 bytes instead of 32 on 32bit arches, and 32 bytes instead of 64 on 64bits)

<net/net_namespace.h> doesnt automatically includes <linux/seq_file_net.h>
anymore.

Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
---
 fs/proc/proc_net.c                                    |    1
 include/linux/netdevice.h                             |   21 ++++------
 include/linux/seq_file_net.h                          |   13 ------
 include/net/dst.h                                     |    4 -
 include/net/inet_hashtables.h                         |    2
 include/net/inet_timewait_sock.h                      |   10 ----
 include/net/ip_fib.h                                  |    2
 include/net/neighbour.h                               |   21 ++--------
 include/net/net_namespace.h                           |   20 +++++++++
 include/net/netfilter/nf_conntrack.h                  |   10 ----
 include/net/netfilter/nf_conntrack_expect.h           |    6 --
 include/net/sock.h                                    |   14 +-----
 net/8021q/vlanproc.c                                  |    1
 net/core/neighbour.c                                  |   12 +----
 net/ipv4/fib_semantics.c                              |    8 +--
 net/ipv4/inet_connection_sock.c                       |    6 +-
 net/ipv4/inet_hashtables.c                            |    7 +--
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c |    1
 net/ipv6/addrlabel.c                                  |   18 +-------
 net/ipv6/route.c                                      |    8 +--
 net/netfilter/nf_conntrack_acct.c                     |    1
 net/netfilter/nf_conntrack_core.c                     |    8 ---
 net/netfilter/nf_conntrack_expect.c                   |    1
 net/netfilter/nf_conntrack_standalone.c               |    1
 net/netfilter/x_tables.c                              |    1
 25 files changed, 79 insertions(+), 118 deletions(-)

View attachment "cond_net.patch" of type "text/plain" (19063 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ