Patrick McHardy
a999e68376
[NETFILTER]: nf_conntrack: sysctl compatibility with old connection tracking
...
This patch adds an option to keep the connection tracking sysctls visible
under their old names.
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:19 -08:00
Patrick McHardy
d62f9ed4a4
[NETFILTER]: nf_conntrack: automatic sysctl registation for conntrack protocols
...
Add helper functions for sysctl registration with optional instantiating
of common path elements (like net/netfilter) and use it for support for
automatic registation of conntrack protocol sysctls.
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:17 -08:00
Patrick McHardy
f8eb24a89a
[NETFILTER]: nf_conntrack: move extern declaration to header files
...
Using extern in a C file is a bad idea because the compiler can't
catch type errors.
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:16 -08:00
Martin Josefsson
824621eddd
[NETFILTER]: nf_conntrack: remove unused struct list_head from protocols
...
Remove unused struct list_head from struct nf_conntrack_l3proto and
nf_conntrack_l4proto as all protocols are kept in arrays, not linked
lists.
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:13 -08:00
Martin Josefsson
ae5718fb3d
[NETFILTER]: nf_conntrack: more sanity checks in protocol registration/unregistration
...
Add some more sanity checks when registering/unregistering l3/l4 protocols.
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:10 -08:00
Martin Josefsson
605dcad6c8
[NETFILTER]: nf_conntrack: rename struct nf_conntrack_protocol
...
Rename 'struct nf_conntrack_protocol' to 'struct nf_conntrack_l4proto' in
order to help distinguish it from 'struct nf_conntrack_l3proto'. It gets
rather confusing with 'nf_conntrack_protocol'.
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:09 -08:00
Martin Josefsson
f61801218a
[NETFILTER]: nf_conntrack: split out the event cache
...
This patch splits out the event cache into its own file
nf_conntrack_ecache.c
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:06 -08:00
Martin Josefsson
7e5d03bb9d
[NETFILTER]: nf_conntrack: split out helper handling
...
This patch splits out handling of helpers into its own file
nf_conntrack_helper.c
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:05 -08:00
Martin Josefsson
77ab9cff0f
[NETFILTER]: nf_conntrack: split out expectation handling
...
This patch splits out expectation handling into its own file
nf_conntrack_expect.c
Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se >
Signed-off-by: Patrick McHardy <kaber@trash.net >
2006-12-02 21:31:04 -08:00
Arnaldo Carvalho de Melo
ee41e2dff1
[INET]: Change protocol field in struct inet_protosw to u16
...
[acme@newtoy net-2.6.20]$ pahole /tmp/tcp_ipv6.o inet_protosw
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/net/protocol.h:69 */
struct inet_protosw {
struct list_head list; /* 0 8 */
short unsigned int type; /* 8 2 */
/* XXX 2 bytes hole, try to pack */
int protocol; /* 12 4 */
struct proto * prot; /* 16 4 */
const struct proto_ops * ops; /* 20 4 */
int capability; /* 24 4 */
char no_check; /* 28 1 */
unsigned char flags; /* 29 1 */
}; /* size: 32, sum members: 28, holes: 1, sum holes: 2, padding: 2 */
So that we can kill that hole, protocol can only go all the way to 255 (RAW).
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com >
2006-12-02 21:30:55 -08:00
Arnaldo Carvalho de Melo
46ca5f5dc4
[XFRM]: Pack struct xfrm_policy
...
[acme@newtoy net-2.6.20]$ pahole net/ipv4/tcp.o xfrm_policy
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
struct xfrm_policy {
struct xfrm_policy * next; /* 0 4 */
struct hlist_node bydst; /* 4 8 */
struct hlist_node byidx; /* 12 8 */
rwlock_t lock; /* 20 36 */
atomic_t refcnt; /* 56 4 */
struct timer_list timer; /* 60 24 */
u8 type; /* 84 1 */
/* XXX 3 bytes hole, try to pack */
u32 priority; /* 88 4 */
u32 index; /* 92 4 */
struct xfrm_selector selector; /* 96 56 */
struct xfrm_lifetime_cfg lft; /* 152 64 */
struct xfrm_lifetime_cur curlft; /* 216 32 */
struct dst_entry * bundles; /* 248 4 */
__u16 family; /* 252 2 */
__u8 action; /* 254 1 */
__u8 flags; /* 255 1 */
__u8 dead; /* 256 1 */
__u8 xfrm_nr; /* 257 1 */
/* XXX 2 bytes hole, try to pack */
struct xfrm_sec_ctx * security; /* 260 4 */
struct xfrm_tmpl xfrm_vec[6]; /* 264 360 */
}; /* size: 624, sum members: 619, holes: 2, sum holes: 5 */
So lets have just one hole instead of two, by moving 'type' to just before 'action',
end result:
[acme@newtoy net-2.6.20]$ codiff -s /tmp/tcp.o.before net/ipv4/tcp.o
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp.c:
struct xfrm_policy | -4
1 struct changed
[acme@newtoy net-2.6.20]$
[acme@newtoy net-2.6.20]$ pahole -c 64 net/ipv4/tcp.o xfrm_policy
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
struct xfrm_policy {
struct xfrm_policy * next; /* 0 4 */
struct hlist_node bydst; /* 4 8 */
struct hlist_node byidx; /* 12 8 */
rwlock_t lock; /* 20 36 */
atomic_t refcnt; /* 56 4 */
struct timer_list timer; /* 60 24 */
u32 priority; /* 84 4 */
u32 index; /* 88 4 */
struct xfrm_selector selector; /* 92 56 */
struct xfrm_lifetime_cfg lft; /* 148 64 */
struct xfrm_lifetime_cur curlft; /* 212 32 */
struct dst_entry * bundles; /* 244 4 */
u16 family; /* 248 2 */
u8 type; /* 250 1 */
u8 action; /* 251 1 */
u8 flags; /* 252 1 */
u8 dead; /* 253 1 */
u8 xfrm_nr; /* 254 1 */
/* XXX 1 byte hole, try to pack */
struct xfrm_sec_ctx * security; /* 256 4 */
struct xfrm_tmpl xfrm_vec[6]; /* 260 360 */
}; /* size: 620, sum members: 619, holes: 1, sum holes: 1 */
Are there any fugly data dependencies here? None that I know.
In the process changed the removed the __ prefixed types, that are just for
userspace visible headers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com >
2006-12-02 21:30:48 -08:00
Arnaldo Carvalho de Melo
850db6b8c5
[INET_CONNECTION_SOCK]: Pack struct inet_connection_sock_af_ops
...
We have a hole in:
[acme@newtoy net-2.6.20]$ pahole net/ipv6/tcp_ipv6.o inet_connection_sock_af_ops
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/net/inet_connection_sock.h:38 */
struct inet_connection_sock_af_ops {
int (*queue_xmit)(); /* 0 4 */
void (*send_check)(); /* 4 4 */
int (*rebuild_header)(); /* 8 4 */
int (*conn_request)(); /* 12 4 */
struct sock * (*syn_recv_sock)(); /* 16 4 */
int (*remember_stamp)(); /* 20 4 */
__u16 net_header_len; /* 24 2 */
/* XXX 2 bytes hole, try to pack */
int (*setsockopt)(); /* 28 4 */
int (*getsockopt)(); /* 32 4 */
int (*compat_setsockopt)(); /* 36 4 */
int (*compat_getsockopt)(); /* 40 4 */
void (*addr2sockaddr)(); /* 44 4 */
int sockaddr_len; /* 48 4 */
}; /* size: 52, sum members: 50, holes: 1, sum holes: 2 */
But we don't need sockaddr_len to be an int:
[acme@newtoy net-2.6.20]$ find net -name "*.[ch]" | xargs grep '\.sockaddr_len.\+=' | sort -u
net/dccp/ipv4.c: .sockaddr_len = sizeof(struct sockaddr_in),
net/dccp/ipv6.c: .sockaddr_len = sizeof(struct sockaddr_in6),
net/ipv4/tcp_ipv4.c: .sockaddr_len = sizeof(struct sockaddr_in),
net/ipv6/tcp_ipv6.c: .sockaddr_len = sizeof(struct sockaddr_in6),
net/sctp/ipv6.c: .sockaddr_len = sizeof(struct sockaddr_in6),
net/sctp/protocol.c: .sockaddr_len = sizeof(struct sockaddr_in),
[acme@newtoy net-2.6.20]$ pahole --sizes net/ipv6/tcp_ipv6.o | grep sockaddr_in
struct sockaddr_in: 16 0
struct sockaddr_in6: 28 0
[acme@newtoy net-2.6.20]$
So I turned sockaddr_len a 'u16', and now:
[acme@newtoy net-2.6.20]$ pahole net/ipv6/tcp_ipv6.o inet_connection_sock_af_ops
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/net/inet_connection_sock.h:38 */
struct inet_connection_sock_af_ops {
int (*queue_xmit)(); /* 0 4 */
void (*send_check)(); /* 4 4 */
int (*rebuild_header)(); /* 8 4 */
int (*conn_request)(); /* 12 4 */
struct sock * (*syn_recv_sock)(); /* 16 4 */
int (*remember_stamp)(); /* 20 4 */
u16 net_header_len; /* 24 2 */
u16 sockaddr_len; /* 26 2 */
int (*setsockopt)(); /* 28 4 */
int (*getsockopt)(); /* 32 4 */
int (*compat_setsockopt)(); /* 36 4 */
int (*compat_getsockopt)(); /* 40 4 */
void (*addr2sockaddr)(); /* 44 4 */
}; /* size: 48 */
So we've saved 4 bytes:
[acme@newtoy net-2.6.20]$ codiff -sV /tmp/tcp_ipv6.o.before net/ipv6/tcp_ipv6.o
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv6/tcp_ipv6.c:
struct inet_connection_sock_af_ops | -4
net_header_len;
from: __u16 /* 24(0) 2(0) */
to: u16 /* 24(0) 2(0) */
sockaddr_len;
from: int /* 48(0) 4(0) */
to: u16 /* 26(0) 2(0) */
1 struct changed
[acme@newtoy net-2.6.20]$
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com >
2006-12-02 21:30:46 -08:00
Gerrit Renker
4c0a6cb0db
[UDP(-Lite)]: consolidate v4 and v6 get|setsockopt code
...
This patch consolidates set/getsockopt code between UDP(-Lite) v4 and 6. The
justification is that UDP(-Lite) is a transport-layer protocol and therefore
the socket option code (at least in theory) should be AF-independent.
Furthermore, there is the following code reduplication:
* do_udp{,v6}_getsockopt is 100% identical between v4 and v6
* do_udp{,v6}_setsockopt is identical up to the following differerence
--v4 in contrast to v4 additionally allows the experimental encapsulation
types UDP_ENCAP_ESPINUDP and UDP_ENCAP_ESPINUDP_NON_IKE
--the remainder is identical between v4 and v6
I believe that this difference is of little relevance.
The advantages in not duplicating twice almost completely identical code.
The patch further simplifies the interface of udp{,v6}_push_pending_frames,
since for the second argument (struct udp_sock *up) it always holds that
up = udp_sk(sk); where sk is the first function argument.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:30:45 -08:00
Thomas Graf
4a89c2562c
[DECNET] address: Convert to new netlink interface
...
Extends the netlink interface to support the __le16 type and
converts address addition, deletion and, dumping to use the
new netlink interface.
Fixes multiple occasions of possible illegal memory references
due to not validated netlink attributes.
Signed-off-by: Thomas Graf <tgraf@suug.ch >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:30:30 -08:00
Al Viro
66c6f529c3
[NET]: net/sched annotations.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:19 -08:00
Al Viro
8e5200f540
[NET]: Fix assorted misannotations (from md5 and udplite merges).
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:16 -08:00
Al Viro
2178eda826
[SCTP]: SCTP_CMD_PROCESS_CTSN annotations.
...
argument passed as __be32
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:14 -08:00
Al Viro
3dbe86566e
[SCTP]: Annotate ->supported_addrs().
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:11 -08:00
Al Viro
e1857ea28d
[SCTP]: sctp_association ->peer.i is a host-endian analog of sctp_inthdr.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:10 -08:00
Al Viro
6fbfa9f951
[SCTP]: Annotate ->inaddr_any().
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:08 -08:00
Al Viro
c9c938cb05
[SCTP]: flip_to_{h,n}() are not needed anymore.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:07 -08:00
Al Viro
516b20ee2d
[SCTP]: ->a_h is gone now.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:05 -08:00
Al Viro
74af924ab6
[SCTP]: ->a_h is gone now.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:27:00 -08:00
Al Viro
80f15d6241
[SCTP]: ->source_h is not used anymore.
...
kill it
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:26:57 -08:00
Al Viro
a926626893
[SCTP]: Switch all remaining users of ->saddr_h to ->saddr.
...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2006-12-02 21:26:56 -08:00