Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
linux
Commits
334f8b2a
Commit
334f8b2a
authored
16 years ago
by
David S. Miller
Browse files
Options
Download
Plain Diff
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.26
parents
7477fd2e
ef1a5a50
Changes
105
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
363 additions
and
147 deletions
+363
-147
include/linux/netfilter.h
include/linux/netfilter.h
+75
-1
include/linux/netfilter/nf_conntrack_dccp.h
include/linux/netfilter/nf_conntrack_dccp.h
+40
-0
include/linux/netfilter/nfnetlink_conntrack.h
include/linux/netfilter/nfnetlink_conntrack.h
+8
-0
include/linux/netfilter/x_tables.h
include/linux/netfilter/x_tables.h
+2
-2
include/linux/netfilter/xt_sctp.h
include/linux/netfilter/xt_sctp.h
+35
-49
include/linux/netfilter_arp/arp_tables.h
include/linux/netfilter_arp/arp_tables.h
+5
-12
include/linux/netfilter_bridge/ebt_nflog.h
include/linux/netfilter_bridge/ebt_nflog.h
+21
-0
include/linux/netfilter_ipv4.h
include/linux/netfilter_ipv4.h
+0
-2
include/net/netfilter/nf_conntrack.h
include/net/netfilter/nf_conntrack.h
+18
-14
include/net/netfilter/nf_conntrack_core.h
include/net/netfilter/nf_conntrack_core.h
+2
-2
include/net/netfilter/nf_conntrack_l3proto.h
include/net/netfilter/nf_conntrack_l3proto.h
+4
-15
include/net/netfilter/nf_conntrack_l4proto.h
include/net/netfilter/nf_conntrack_l4proto.h
+6
-7
include/net/netfilter/nf_conntrack_tuple.h
include/net/netfilter/nf_conntrack_tuple.h
+27
-20
include/net/netfilter/nf_nat_helper.h
include/net/netfilter/nf_nat_helper.h
+3
-0
include/net/netfilter/nf_nat_protocol.h
include/net/netfilter/nf_nat_protocol.h
+27
-19
include/net/netfilter/nf_nat_rule.h
include/net/netfilter/nf_nat_rule.h
+0
-3
net/bridge/netfilter/Kconfig
net/bridge/netfilter/Kconfig
+14
-0
net/bridge/netfilter/Makefile
net/bridge/netfilter/Makefile
+1
-0
net/bridge/netfilter/ebt_nflog.c
net/bridge/netfilter/ebt_nflog.c
+74
-0
net/bridge/netfilter/ebtable_broute.c
net/bridge/netfilter/ebtable_broute.c
+1
-1
No files found.
include/linux/netfilter.h
View file @
334f8b2a
...
@@ -6,11 +6,13 @@
...
@@ -6,11 +6,13 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/net.h>
#include <linux/net.h>
#include <linux/netdevice.h>
#include <linux/if.h>
#include <linux/if.h>
#include <linux/in.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/in6.h>
#include <linux/wait.h>
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/list.h>
#include <net/net_namespace.h>
#endif
#endif
#include <linux/compiler.h>
#include <linux/compiler.h>
...
@@ -76,7 +78,6 @@ extern void netfilter_init(void);
...
@@ -76,7 +78,6 @@ extern void netfilter_init(void);
#define NF_MAX_HOOKS 8
#define NF_MAX_HOOKS 8
struct
sk_buff
;
struct
sk_buff
;
struct
net_device
;
typedef
unsigned
int
nf_hookfn
(
unsigned
int
hooknum
,
typedef
unsigned
int
nf_hookfn
(
unsigned
int
hooknum
,
struct
sk_buff
*
skb
,
struct
sk_buff
*
skb
,
...
@@ -233,6 +234,11 @@ struct nf_afinfo {
...
@@ -233,6 +234,11 @@ struct nf_afinfo {
unsigned
short
family
;
unsigned
short
family
;
__sum16
(
*
checksum
)(
struct
sk_buff
*
skb
,
unsigned
int
hook
,
__sum16
(
*
checksum
)(
struct
sk_buff
*
skb
,
unsigned
int
hook
,
unsigned
int
dataoff
,
u_int8_t
protocol
);
unsigned
int
dataoff
,
u_int8_t
protocol
);
__sum16
(
*
checksum_partial
)(
struct
sk_buff
*
skb
,
unsigned
int
hook
,
unsigned
int
dataoff
,
unsigned
int
len
,
u_int8_t
protocol
);
int
(
*
route
)(
struct
dst_entry
**
dst
,
struct
flowi
*
fl
);
int
(
*
route
)(
struct
dst_entry
**
dst
,
struct
flowi
*
fl
);
void
(
*
saveroute
)(
const
struct
sk_buff
*
skb
,
void
(
*
saveroute
)(
const
struct
sk_buff
*
skb
,
struct
nf_queue_entry
*
entry
);
struct
nf_queue_entry
*
entry
);
...
@@ -262,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
...
@@ -262,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
return
csum
;
return
csum
;
}
}
static
inline
__sum16
nf_checksum_partial
(
struct
sk_buff
*
skb
,
unsigned
int
hook
,
unsigned
int
dataoff
,
unsigned
int
len
,
u_int8_t
protocol
,
unsigned
short
family
)
{
const
struct
nf_afinfo
*
afinfo
;
__sum16
csum
=
0
;
rcu_read_lock
();
afinfo
=
nf_get_afinfo
(
family
);
if
(
afinfo
)
csum
=
afinfo
->
checksum_partial
(
skb
,
hook
,
dataoff
,
len
,
protocol
);
rcu_read_unlock
();
return
csum
;
}
extern
int
nf_register_afinfo
(
const
struct
nf_afinfo
*
afinfo
);
extern
int
nf_register_afinfo
(
const
struct
nf_afinfo
*
afinfo
);
extern
void
nf_unregister_afinfo
(
const
struct
nf_afinfo
*
afinfo
);
extern
void
nf_unregister_afinfo
(
const
struct
nf_afinfo
*
afinfo
);
...
@@ -320,5 +343,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
...
@@ -320,5 +343,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
static
inline
void
nf_ct_attach
(
struct
sk_buff
*
new
,
struct
sk_buff
*
skb
)
{}
static
inline
void
nf_ct_attach
(
struct
sk_buff
*
new
,
struct
sk_buff
*
skb
)
{}
#endif
#endif
static
inline
struct
net
*
nf_pre_routing_net
(
const
struct
net_device
*
in
,
const
struct
net_device
*
out
)
{
#ifdef CONFIG_NET_NS
return
in
->
nd_net
;
#else
return
&
init_net
;
#endif
}
static
inline
struct
net
*
nf_local_in_net
(
const
struct
net_device
*
in
,
const
struct
net_device
*
out
)
{
#ifdef CONFIG_NET_NS
return
in
->
nd_net
;
#else
return
&
init_net
;
#endif
}
static
inline
struct
net
*
nf_forward_net
(
const
struct
net_device
*
in
,
const
struct
net_device
*
out
)
{
#ifdef CONFIG_NET_NS
BUG_ON
(
in
->
nd_net
!=
out
->
nd_net
);
return
in
->
nd_net
;
#else
return
&
init_net
;
#endif
}
static
inline
struct
net
*
nf_local_out_net
(
const
struct
net_device
*
in
,
const
struct
net_device
*
out
)
{
#ifdef CONFIG_NET_NS
return
out
->
nd_net
;
#else
return
&
init_net
;
#endif
}
static
inline
struct
net
*
nf_post_routing_net
(
const
struct
net_device
*
in
,
const
struct
net_device
*
out
)
{
#ifdef CONFIG_NET_NS
return
out
->
nd_net
;
#else
return
&
init_net
;
#endif
}
#endif
/*__KERNEL__*/
#endif
/*__KERNEL__*/
#endif
/*__LINUX_NETFILTER_H*/
#endif
/*__LINUX_NETFILTER_H*/
This diff is collapsed.
Click to expand it.
include/linux/netfilter/nf_conntrack_dccp.h
0 → 100644
View file @
334f8b2a
#ifndef _NF_CONNTRACK_DCCP_H
#define _NF_CONNTRACK_DCCP_H
/* Exposed to userspace over nfnetlink */
enum
ct_dccp_states
{
CT_DCCP_NONE
,
CT_DCCP_REQUEST
,
CT_DCCP_RESPOND
,
CT_DCCP_PARTOPEN
,
CT_DCCP_OPEN
,
CT_DCCP_CLOSEREQ
,
CT_DCCP_CLOSING
,
CT_DCCP_TIMEWAIT
,
CT_DCCP_IGNORE
,
CT_DCCP_INVALID
,
__CT_DCCP_MAX
};
#define CT_DCCP_MAX (__CT_DCCP_MAX - 1)
enum
ct_dccp_roles
{
CT_DCCP_ROLE_CLIENT
,
CT_DCCP_ROLE_SERVER
,
__CT_DCCP_ROLE_MAX
};
#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1)
#ifdef __KERNEL__
#include <net/netfilter/nf_conntrack_tuple.h>
struct
nf_ct_dccp
{
u_int8_t
role
[
IP_CT_DIR_MAX
];
u_int8_t
state
;
u_int8_t
last_pkt
;
u_int8_t
last_dir
;
u_int64_t
handshake_seq
;
};
#endif
/* __KERNEL__ */
#endif
/* _NF_CONNTRACK_DCCP_H */
This diff is collapsed.
Click to expand it.
include/linux/netfilter/nfnetlink_conntrack.h
View file @
334f8b2a
...
@@ -80,6 +80,7 @@ enum ctattr_l4proto {
...
@@ -80,6 +80,7 @@ enum ctattr_l4proto {
enum
ctattr_protoinfo
{
enum
ctattr_protoinfo
{
CTA_PROTOINFO_UNSPEC
,
CTA_PROTOINFO_UNSPEC
,
CTA_PROTOINFO_TCP
,
CTA_PROTOINFO_TCP
,
CTA_PROTOINFO_DCCP
,
__CTA_PROTOINFO_MAX
__CTA_PROTOINFO_MAX
};
};
#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
...
@@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp {
...
@@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp {
};
};
#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
enum
ctattr_protoinfo_dccp
{
CTA_PROTOINFO_DCCP_UNSPEC
,
CTA_PROTOINFO_DCCP_STATE
,
__CTA_PROTOINFO_DCCP_MAX
,
};
#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
enum
ctattr_counters
{
enum
ctattr_counters
{
CTA_COUNTERS_UNSPEC
,
CTA_COUNTERS_UNSPEC
,
CTA_COUNTERS_PACKETS
,
/* old 64bit counters */
CTA_COUNTERS_PACKETS
,
/* old 64bit counters */
...
...
This diff is collapsed.
Click to expand it.
include/linux/netfilter/x_tables.h
View file @
334f8b2a
...
@@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
...
@@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
extern
void
xt_compat_flush_offsets
(
int
af
);
extern
void
xt_compat_flush_offsets
(
int
af
);
extern
short
xt_compat_calc_jump
(
int
af
,
unsigned
int
offset
);
extern
short
xt_compat_calc_jump
(
int
af
,
unsigned
int
offset
);
extern
int
xt_compat_match_offset
(
struct
xt_match
*
match
);
extern
int
xt_compat_match_offset
(
const
struct
xt_match
*
match
);
extern
int
xt_compat_match_from_user
(
struct
xt_entry_match
*
m
,
extern
int
xt_compat_match_from_user
(
struct
xt_entry_match
*
m
,
void
**
dstptr
,
unsigned
int
*
size
);
void
**
dstptr
,
unsigned
int
*
size
);
extern
int
xt_compat_match_to_user
(
struct
xt_entry_match
*
m
,
extern
int
xt_compat_match_to_user
(
struct
xt_entry_match
*
m
,
void
__user
**
dstptr
,
unsigned
int
*
size
);
void
__user
**
dstptr
,
unsigned
int
*
size
);
extern
int
xt_compat_target_offset
(
struct
xt_target
*
target
);
extern
int
xt_compat_target_offset
(
const
struct
xt_target
*
target
);
extern
void
xt_compat_target_from_user
(
struct
xt_entry_target
*
t
,
extern
void
xt_compat_target_from_user
(
struct
xt_entry_target
*
t
,
void
**
dstptr
,
unsigned
int
*
size
);
void
**
dstptr
,
unsigned
int
*
size
);
extern
int
xt_compat_target_to_user
(
struct
xt_entry_target
*
t
,
extern
int
xt_compat_target_to_user
(
struct
xt_entry_target
*
t
,
...
...
This diff is collapsed.
Click to expand it.
include/linux/netfilter/xt_sctp.h
View file @
334f8b2a
...
@@ -37,68 +37,54 @@ struct xt_sctp_info {
...
@@ -37,68 +37,54 @@ struct xt_sctp_info {
#define SCTP_CHUNKMAP_SET(chunkmap, type) \
#define SCTP_CHUNKMAP_SET(chunkmap, type) \
do { \
do { \
chunkmap[type / bytes(u_int32_t)] |= \
(
chunkmap
)
[type / bytes(u_int32_t)] |= \
1 << (type % bytes(u_int32_t)); \
1 << (type % bytes(u_int32_t)); \
} while (0)
} while (0)
#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
do { \
do { \
chunkmap[type / bytes(u_int32_t)] &= \
(
chunkmap
)
[type / bytes(u_int32_t)] &= \
~(1 << (type % bytes(u_int32_t))); \
~(1 << (type % bytes(u_int32_t))); \
} while (0)
} while (0)
#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
({ \
({ \
(chunkmap[type / bytes (u_int32_t)] &
\
(
(chunkmap
)
[type / bytes (u_int32_t)] & \
(1 << (type % bytes (u_int32_t)))) ? 1: 0; \
(1 << (type % bytes (u_int32_t)))) ? 1: 0; \
})
})
#define SCTP_CHUNKMAP_RESET(chunkmap) \
#define SCTP_CHUNKMAP_RESET(chunkmap) \
do { \
memset((chunkmap), 0, sizeof(chunkmap))
int i; \
for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
chunkmap[i] = 0; \
memset((chunkmap), ~0U, sizeof(chunkmap))
} while (0)
#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
memcpy((destmap), (srcmap), sizeof(srcmap))
do { \
int i; \
#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
__sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
chunkmap[i] = ~0; \
static
inline
bool
} while (0)
__sctp_chunkmap_is_clear
(
const
u_int32_t
*
chunkmap
,
unsigned
int
n
)
{
#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
unsigned
int
i
;
do { \
for
(
i
=
0
;
i
<
n
;
++
i
)
int i; \
if
(
chunkmap
[
i
])
for (i = 0; i < ARRAY_SIZE(srcmap); i++) \
return
false
;
destmap[i] = srcmap[i]; \
return
true
;
} while (0)
}
#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
({ \
__sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
int i; \
static
inline
bool
int flag = 1; \
__sctp_chunkmap_is_all_set
(
const
u_int32_t
*
chunkmap
,
unsigned
int
n
)
for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
{
if (chunkmap[i]) { \
unsigned
int
i
;
flag = 0; \
for
(
i
=
0
;
i
<
n
;
++
i
)
break; \
if
(
chunkmap
[
i
]
!=
~
0U
)
} \
return
false
;
} \
return
true
;
flag; \
}
})
#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
({ \
int i; \
int flag = 1; \
for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
if (chunkmap[i] != ~0) { \
flag = 0; \
break; \
} \
} \
flag; \
})
#endif
/* _XT_SCTP_H_ */
#endif
/* _XT_SCTP_H_ */
This diff is collapsed.
Click to expand it.
include/linux/netfilter_arp/arp_tables.h
View file @
334f8b2a
...
@@ -23,8 +23,6 @@
...
@@ -23,8 +23,6 @@
#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
#define arpt_target xt_target
#define arpt_table xt_table
#define ARPT_DEV_ADDR_LEN_MAX 16
#define ARPT_DEV_ADDR_LEN_MAX 16
...
@@ -266,20 +264,15 @@ struct arpt_error
...
@@ -266,20 +264,15 @@ struct arpt_error
.target.errorname = "ERROR", \
.target.errorname = "ERROR", \
}
}
#define arpt_register_target(tgt) \
extern
struct
xt_table
*
arpt_register_table
(
struct
net
*
net
,
({ (tgt)->family = NF_ARP; \
struct
xt_table
*
table
,
xt_register_target(tgt); })
const
struct
arpt_replace
*
repl
);
#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
extern
void
arpt_unregister_table
(
struct
xt_table
*
table
);
extern
struct
arpt_table
*
arpt_register_table
(
struct
net
*
net
,
struct
arpt_table
*
table
,
const
struct
arpt_replace
*
repl
);
extern
void
arpt_unregister_table
(
struct
arpt_table
*
table
);
extern
unsigned
int
arpt_do_table
(
struct
sk_buff
*
skb
,
extern
unsigned
int
arpt_do_table
(
struct
sk_buff
*
skb
,
unsigned
int
hook
,
unsigned
int
hook
,
const
struct
net_device
*
in
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
const
struct
net_device
*
out
,
struct
arp
t_table
*
table
);
struct
x
t_table
*
table
);
#define ARPT_ALIGN(s) XT_ALIGN(s)
#define ARPT_ALIGN(s) XT_ALIGN(s)
...
...
This diff is collapsed.
Click to expand it.
include/linux/netfilter_bridge/ebt_nflog.h
0 → 100644
View file @
334f8b2a
#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
#define __LINUX_BRIDGE_EBT_NFLOG_H
#define EBT_NFLOG_MASK 0x0
#define EBT_NFLOG_PREFIX_SIZE 64
#define EBT_NFLOG_WATCHER "nflog"
#define EBT_NFLOG_DEFAULT_GROUP 0x1
#define EBT_NFLOG_DEFAULT_THRESHOLD 1
struct
ebt_nflog_info
{
u_int32_t
len
;
u_int16_t
group
;
u_int16_t
threshold
;
u_int16_t
flags
;
u_int16_t
pad
;
char
prefix
[
EBT_NFLOG_PREFIX_SIZE
];
};
#endif
/* __LINUX_BRIDGE_EBT_NFLOG_H */
This diff is collapsed.
Click to expand it.
include/linux/netfilter_ipv4.h
View file @
334f8b2a
...
@@ -62,8 +62,6 @@ enum nf_ip_hook_priorities {
...
@@ -62,8 +62,6 @@ enum nf_ip_hook_priorities {
NF_IP_PRI_FILTER
=
0
,
NF_IP_PRI_FILTER
=
0
,
NF_IP_PRI_NAT_SRC
=
100
,
NF_IP_PRI_NAT_SRC
=
100
,
NF_IP_PRI_SELINUX_LAST
=
225
,
NF_IP_PRI_SELINUX_LAST
=
225
,
NF_IP_PRI_CONNTRACK_HELPER
=
INT_MAX
-
2
,
NF_IP_PRI_NAT_SEQ_ADJUST
=
INT_MAX
-
1
,
NF_IP_PRI_CONNTRACK_CONFIRM
=
INT_MAX
,
NF_IP_PRI_CONNTRACK_CONFIRM
=
INT_MAX
,
NF_IP_PRI_LAST
=
INT_MAX
,
NF_IP_PRI_LAST
=
INT_MAX
,
};
};
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_conntrack.h
View file @
334f8b2a
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <asm/atomic.h>
#include <asm/atomic.h>
#include <linux/netfilter/nf_conntrack_tcp.h>
#include <linux/netfilter/nf_conntrack_tcp.h>
#include <linux/netfilter/nf_conntrack_dccp.h>
#include <linux/netfilter/nf_conntrack_sctp.h>
#include <linux/netfilter/nf_conntrack_sctp.h>
#include <linux/netfilter/nf_conntrack_proto_gre.h>
#include <linux/netfilter/nf_conntrack_proto_gre.h>
#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
...
@@ -30,6 +31,7 @@
...
@@ -30,6 +31,7 @@
/* per conntrack: protocol private data */
/* per conntrack: protocol private data */
union
nf_conntrack_proto
{
union
nf_conntrack_proto
{
/* insert conntrack proto private data here */
/* insert conntrack proto private data here */
struct
nf_ct_dccp
dccp
;
struct
ip_ct_sctp
sctp
;
struct
ip_ct_sctp
sctp
;
struct
ip_ct_tcp
tcp
;
struct
ip_ct_tcp
tcp
;
struct
ip_ct_icmp
icmp
;
struct
ip_ct_icmp
icmp
;
...
@@ -63,14 +65,7 @@ union nf_conntrack_help {
...
@@ -63,14 +65,7 @@ union nf_conntrack_help {
#include <linux/timer.h>
#include <linux/timer.h>
#ifdef CONFIG_NETFILTER_DEBUG
#ifdef CONFIG_NETFILTER_DEBUG
#define NF_CT_ASSERT(x) \
#define NF_CT_ASSERT(x) WARN_ON(!(x))
do { \
if (!(x)) \
/* Wooah! I'm tripping my conntrack in a frenzy of \
netplay... */
\
printk("NF_CT_ASSERT: %s:%i(%s)\n", \
__FILE__, __LINE__, __FUNCTION__); \
} while(0)
#else
#else
#define NF_CT_ASSERT(x)
#define NF_CT_ASSERT(x)
#endif
#endif
...
@@ -145,6 +140,16 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
...
@@ -145,6 +140,16 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
tuplehash
[
hash
->
tuple
.
dst
.
dir
]);
tuplehash
[
hash
->
tuple
.
dst
.
dir
]);
}
}
static
inline
u_int16_t
nf_ct_l3num
(
const
struct
nf_conn
*
ct
)
{
return
ct
->
tuplehash
[
IP_CT_DIR_ORIGINAL
].
tuple
.
src
.
l3num
;
}
static
inline
u_int8_t
nf_ct_protonum
(
const
struct
nf_conn
*
ct
)
{
return
ct
->
tuplehash
[
IP_CT_DIR_ORIGINAL
].
tuple
.
dst
.
protonum
;
}
/* get master conntrack via master expectation */
/* get master conntrack via master expectation */
#define master_ct(conntr) (conntr->master)
#define master_ct(conntr) (conntr->master)
...
@@ -189,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct);
...
@@ -189,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct);
extern
void
nf_conntrack_flush
(
void
);
extern
void
nf_conntrack_flush
(
void
);
extern
int
nf_ct_get_tuplepr
(
const
struct
sk_buff
*
skb
,
extern
bool
nf_ct_get_tuplepr
(
const
struct
sk_buff
*
skb
,
unsigned
int
nhoff
,
unsigned
int
nhoff
,
u_int16_t
l3num
,
u_int16_t
l3num
,
struct
nf_conntrack_tuple
*
tuple
);
struct
nf_conntrack_tuple
*
tuple
);
extern
bool
nf_ct_invert_tuplepr
(
struct
nf_conntrack_tuple
*
inverse
,
extern
int
nf_ct_invert_tuplepr
(
struct
nf_conntrack_tuple
*
inverse
,
const
struct
nf_conntrack_tuple
*
orig
);
const
struct
nf_conntrack_tuple
*
orig
);
extern
void
__nf_ct_refresh_acct
(
struct
nf_conn
*
ct
,
extern
void
__nf_ct_refresh_acct
(
struct
nf_conn
*
ct
,
enum
ip_conntrack_info
ctinfo
,
enum
ip_conntrack_info
ctinfo
,
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_conntrack_core.h
View file @
334f8b2a
...
@@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void);
...
@@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void);
extern
int
nf_conntrack_proto_init
(
void
);
extern
int
nf_conntrack_proto_init
(
void
);
extern
void
nf_conntrack_proto_fini
(
void
);
extern
void
nf_conntrack_proto_fini
(
void
);
extern
int
extern
bool
nf_ct_get_tuple
(
const
struct
sk_buff
*
skb
,
nf_ct_get_tuple
(
const
struct
sk_buff
*
skb
,
unsigned
int
nhoff
,
unsigned
int
nhoff
,
unsigned
int
dataoff
,
unsigned
int
dataoff
,
...
@@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb,
...
@@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb,
const
struct
nf_conntrack_l3proto
*
l3proto
,
const
struct
nf_conntrack_l3proto
*
l3proto
,
const
struct
nf_conntrack_l4proto
*
l4proto
);
const
struct
nf_conntrack_l4proto
*
l4proto
);
extern
int
extern
bool
nf_ct_invert_tuple
(
struct
nf_conntrack_tuple
*
inverse
,
nf_ct_invert_tuple
(
struct
nf_conntrack_tuple
*
inverse
,
const
struct
nf_conntrack_tuple
*
orig
,
const
struct
nf_conntrack_tuple
*
orig
,
const
struct
nf_conntrack_l3proto
*
l3proto
,
const
struct
nf_conntrack_l3proto
*
l3proto
,
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_conntrack_l3proto.h
View file @
334f8b2a
...
@@ -28,31 +28,20 @@ struct nf_conntrack_l3proto
...
@@ -28,31 +28,20 @@ struct nf_conntrack_l3proto
* Try to fill in the third arg: nhoff is offset of l3 proto
* Try to fill in the third arg: nhoff is offset of l3 proto
* hdr. Return true if possible.
* hdr. Return true if possible.
*/
*/
int
(
*
pkt_to_tuple
)(
const
struct
sk_buff
*
skb
,
unsigned
int
nhoff
,
bool
(
*
pkt_to_tuple
)(
const
struct
sk_buff
*
skb
,
unsigned
int
nhoff
,
struct
nf_conntrack_tuple
*
tuple
);
struct
nf_conntrack_tuple
*
tuple
);
/*
/*
* Invert the per-proto part of the tuple: ie. turn xmit into reply.
* Invert the per-proto part of the tuple: ie. turn xmit into reply.
* Some packets can't be inverted: return 0 in that case.
* Some packets can't be inverted: return 0 in that case.
*/
*/
int
(
*
invert_tuple
)(
struct
nf_conntrack_tuple
*
inverse
,
bool
(
*
invert_tuple
)(
struct
nf_conntrack_tuple
*
inverse
,
const
struct
nf_conntrack_tuple
*
orig
);
const
struct
nf_conntrack_tuple
*
orig
);
/* Print out the per-protocol part of the tuple. */
/* Print out the per-protocol part of the tuple. */
int
(
*
print_tuple
)(
struct
seq_file
*
s
,
int
(
*
print_tuple
)(
struct
seq_file
*
s
,
const
struct
nf_conntrack_tuple
*
);
const
struct
nf_conntrack_tuple
*
);
/* Returns verdict for packet, or -1 for invalid. */
int
(
*
packet
)(
struct
nf_conn
*
ct
,
const
struct
sk_buff
*
skb
,
enum
ip_conntrack_info
ctinfo
);
/*
* Called when a new connection for this protocol found;
* returns TRUE if it's OK. If so, packet() called next.
*/
int
(
*
new
)(
struct
nf_conn
*
ct
,
const
struct
sk_buff
*
skb
);
/*
/*
* Called before tracking.
* Called before tracking.
* *dataoff: offset of protocol header (TCP, UDP,...) in skb
* *dataoff: offset of protocol header (TCP, UDP,...) in skb
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_conntrack_l4proto.h
View file @
334f8b2a
...
@@ -25,15 +25,14 @@ struct nf_conntrack_l4proto
...
@@ -25,15 +25,14 @@ struct nf_conntrack_l4proto
/* Try to fill in the third arg: dataoff is offset past network protocol
/* Try to fill in the third arg: dataoff is offset past network protocol
hdr. Return true if possible. */
hdr. Return true if possible. */
int
(
*
pkt_to_tuple
)(
const
struct
sk_buff
*
skb
,
bool
(
*
pkt_to_tuple
)(
const
struct
sk_buff
*
skb
,
unsigned
int
dataoff
,
unsigned
int
dataoff
,
struct
nf_conntrack_tuple
*
tuple
);
struct
nf_conntrack_tuple
*
tuple
);
/* Invert the per-proto part of the tuple: ie. turn xmit into reply.
/* Invert the per-proto part of the tuple: ie. turn xmit into reply.
* Some packets can't be inverted: return 0 in that case.
* Some packets can't be inverted: return 0 in that case.
*/
*/
int
(
*
invert_tuple
)(
struct
nf_conntrack_tuple
*
inverse
,
bool
(
*
invert_tuple
)(
struct
nf_conntrack_tuple
*
inverse
,
const
struct
nf_conntrack_tuple
*
orig
);
const
struct
nf_conntrack_tuple
*
orig
);
/* Returns verdict for packet, or -1 for invalid. */
/* Returns verdict for packet, or -1 for invalid. */
int
(
*
packet
)(
struct
nf_conn
*
ct
,
int
(
*
packet
)(
struct
nf_conn
*
ct
,
...
@@ -45,8 +44,8 @@ struct nf_conntrack_l4proto
...
@@ -45,8 +44,8 @@ struct nf_conntrack_l4proto
/* Called when a new connection for this protocol found;
/* Called when a new connection for this protocol found;
* returns TRUE if it's OK. If so, packet() called next. */
* returns TRUE if it's OK. If so, packet() called next. */
int
(
*
new
)(
struct
nf_conn
*
ct
,
const
struct
sk_buff
*
skb
,
bool
(
*
new
)(
struct
nf_conn
*
ct
,
const
struct
sk_buff
*
skb
,
unsigned
int
dataoff
);
unsigned
int
dataoff
);
/* Called when a conntrack entry is destroyed */
/* Called when a conntrack entry is destroyed */
void
(
*
destroy
)(
struct
nf_conn
*
ct
);
void
(
*
destroy
)(
struct
nf_conn
*
ct
);
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_conntrack_tuple.h
View file @
334f8b2a
...
@@ -39,6 +39,9 @@ union nf_conntrack_man_proto
...
@@ -39,6 +39,9 @@ union nf_conntrack_man_proto
struct
{
struct
{
__be16
id
;
__be16
id
;
}
icmp
;
}
icmp
;
struct
{
__be16
port
;
}
dccp
;
struct
{
struct
{
__be16
port
;
__be16
port
;
}
sctp
;
}
sctp
;
...
@@ -77,6 +80,9 @@ struct nf_conntrack_tuple
...
@@ -77,6 +80,9 @@ struct nf_conntrack_tuple
struct
{
struct
{
u_int8_t
type
,
code
;
u_int8_t
type
,
code
;
}
icmp
;
}
icmp
;
struct
{
__be16
port
;
}
dccp
;
struct
{
struct
{
__be16
port
;
__be16
port
;
}
sctp
;
}
sctp
;
...
@@ -145,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
...
@@ -145,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
}
}
}
}
#define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp)
/* If we're the first tuple, it's the original dir. */
/* If we're the first tuple, it's the original dir. */
#define NF_CT_DIRECTION(h) \
#define NF_CT_DIRECTION(h) \
((enum ip_conntrack_dir)(h)->tuple.dst.dir)
((enum ip_conntrack_dir)(h)->tuple.dst.dir)
...
@@ -160,61 +164,64 @@ struct nf_conntrack_tuple_hash
...
@@ -160,61 +164,64 @@ struct nf_conntrack_tuple_hash
#endif
/* __KERNEL__ */
#endif
/* __KERNEL__ */
static
inline
int
__nf_ct_tuple_src_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
static
inline
bool
__nf_ct_tuple_src_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
const
struct
nf_conntrack_tuple
*
t2
)
const
struct
nf_conntrack_tuple
*
t2
)
{
{
return
(
nf_inet_addr_cmp
(
&
t1
->
src
.
u3
,
&
t2
->
src
.
u3
)
&&
return
(
nf_inet_addr_cmp
(
&
t1
->
src
.
u3
,
&
t2
->
src
.
u3
)
&&
t1
->
src
.
u
.
all
==
t2
->
src
.
u
.
all
&&
t1
->
src
.
u
.
all
==
t2
->
src
.
u
.
all
&&
t1
->
src
.
l3num
==
t2
->
src
.
l3num
);
t1
->
src
.
l3num
==
t2
->
src
.
l3num
);
}
}
static
inline
int
__nf_ct_tuple_dst_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
static
inline
bool
__nf_ct_tuple_dst_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
const
struct
nf_conntrack_tuple
*
t2
)
const
struct
nf_conntrack_tuple
*
t2
)
{
{
return
(
nf_inet_addr_cmp
(
&
t1
->
dst
.
u3
,
&
t2
->
dst
.
u3
)
&&
return
(
nf_inet_addr_cmp
(
&
t1
->
dst
.
u3
,
&
t2
->
dst
.
u3
)
&&
t1
->
dst
.
u
.
all
==
t2
->
dst
.
u
.
all
&&
t1
->
dst
.
u
.
all
==
t2
->
dst
.
u
.
all
&&
t1
->
dst
.
protonum
==
t2
->
dst
.
protonum
);
t1
->
dst
.
protonum
==
t2
->
dst
.
protonum
);
}
}
static
inline
int
nf_ct_tuple_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
static
inline
bool
nf_ct_tuple_equal
(
const
struct
nf_conntrack_tuple
*
t1
,
const
struct
nf_conntrack_tuple
*
t2
)
const
struct
nf_conntrack_tuple
*
t2
)
{
{
return
__nf_ct_tuple_src_equal
(
t1
,
t2
)
&&
return
__nf_ct_tuple_src_equal
(
t1
,
t2
)
&&
__nf_ct_tuple_dst_equal
(
t1
,
t2
);
__nf_ct_tuple_dst_equal
(
t1
,
t2
);
}
}
static
inline
int
nf_ct_tuple_mask_equal
(
const
struct
nf_conntrack_tuple_mask
*
m1
,
static
inline
bool
const
struct
nf_conntrack_tuple_mask
*
m2
)
nf_ct_tuple_mask_equal
(
const
struct
nf_conntrack_tuple_mask
*
m1
,
const
struct
nf_conntrack_tuple_mask
*
m2
)
{
{
return
(
nf_inet_addr_cmp
(
&
m1
->
src
.
u3
,
&
m2
->
src
.
u3
)
&&
return
(
nf_inet_addr_cmp
(
&
m1
->
src
.
u3
,
&
m2
->
src
.
u3
)
&&
m1
->
src
.
u
.
all
==
m2
->
src
.
u
.
all
);
m1
->
src
.
u
.
all
==
m2
->
src
.
u
.
all
);
}
}
static
inline
int
nf_ct_tuple_src_mask_cmp
(
const
struct
nf_conntrack_tuple
*
t1
,
static
inline
bool
const
struct
nf_conntrack_tuple
*
t2
,
nf_ct_tuple_src_mask_cmp
(
const
struct
nf_conntrack_tuple
*
t1
,
const
struct
nf_conntrack_tuple_mask
*
mask
)
const
struct
nf_conntrack_tuple
*
t2
,
const
struct
nf_conntrack_tuple_mask
*
mask
)
{
{
int
count
;
int
count
;
for
(
count
=
0
;
count
<
NF_CT_TUPLE_L3SIZE
;
count
++
)
{
for
(
count
=
0
;
count
<
NF_CT_TUPLE_L3SIZE
;
count
++
)
{
if
((
t1
->
src
.
u3
.
all
[
count
]
^
t2
->
src
.
u3
.
all
[
count
])
&
if
((
t1
->
src
.
u3
.
all
[
count
]
^
t2
->
src
.
u3
.
all
[
count
])
&
mask
->
src
.
u3
.
all
[
count
])
mask
->
src
.
u3
.
all
[
count
])
return
0
;
return
false
;
}
}
if
((
t1
->
src
.
u
.
all
^
t2
->
src
.
u
.
all
)
&
mask
->
src
.
u
.
all
)
if
((
t1
->
src
.
u
.
all
^
t2
->
src
.
u
.
all
)
&
mask
->
src
.
u
.
all
)
return
0
;
return
false
;
if
(
t1
->
src
.
l3num
!=
t2
->
src
.
l3num
||
if
(
t1
->
src
.
l3num
!=
t2
->
src
.
l3num
||
t1
->
dst
.
protonum
!=
t2
->
dst
.
protonum
)
t1
->
dst
.
protonum
!=
t2
->
dst
.
protonum
)
return
0
;
return
false
;
return
1
;
return
true
;
}
}
static
inline
int
nf_ct_tuple_mask_cmp
(
const
struct
nf_conntrack_tuple
*
t
,
static
inline
bool
const
struct
nf_conntrack_tuple
*
tuple
,
nf_ct_tuple_mask_cmp
(
const
struct
nf_conntrack_tuple
*
t
,
const
struct
nf_conntrack_tuple_mask
*
mask
)
const
struct
nf_conntrack_tuple
*
tuple
,
const
struct
nf_conntrack_tuple_mask
*
mask
)
{
{
return
nf_ct_tuple_src_mask_cmp
(
t
,
tuple
,
mask
)
&&
return
nf_ct_tuple_src_mask_cmp
(
t
,
tuple
,
mask
)
&&
__nf_ct_tuple_dst_equal
(
t
,
tuple
);
__nf_ct_tuple_dst_equal
(
t
,
tuple
);
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_nat_helper.h
View file @
334f8b2a
...
@@ -24,6 +24,9 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
...
@@ -24,6 +24,9 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
extern
int
nf_nat_seq_adjust
(
struct
sk_buff
*
skb
,
extern
int
nf_nat_seq_adjust
(
struct
sk_buff
*
skb
,
struct
nf_conn
*
ct
,
struct
nf_conn
*
ct
,
enum
ip_conntrack_info
ctinfo
);
enum
ip_conntrack_info
ctinfo
);
extern
int
(
*
nf_nat_seq_adjust_hook
)(
struct
sk_buff
*
skb
,
struct
nf_conn
*
ct
,
enum
ip_conntrack_info
ctinfo
);
/* Setup NAT on this expected conntrack so it follows master, but goes
/* Setup NAT on this expected conntrack so it follows master, but goes
* to port ct->master->saved_proto. */
* to port ct->master->saved_proto. */
...
...
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_nat_protocol.h
View file @
334f8b2a
...
@@ -8,9 +8,6 @@ struct nf_nat_range;
...
@@ -8,9 +8,6 @@ struct nf_nat_range;
struct
nf_nat_protocol
struct
nf_nat_protocol
{
{
/* Protocol name */
const
char
*
name
;
/* Protocol number. */
/* Protocol number. */
unsigned
int
protonum
;
unsigned
int
protonum
;
...
@@ -18,25 +15,25 @@ struct nf_nat_protocol
...
@@ -18,25 +15,25 @@ struct nf_nat_protocol
/* Translate a packet to the target according to manip type.
/* Translate a packet to the target according to manip type.
Return true if succeeded. */
Return true if succeeded. */
int
(
*
manip_pkt
)(
struct
sk_buff
*
skb
,
bool
(
*
manip_pkt
)(
struct
sk_buff
*
skb
,
unsigned
int
iphdroff
,
unsigned
int
iphdroff
,
const
struct
nf_conntrack_tuple
*
tuple
,
const
struct
nf_conntrack_tuple
*
tuple
,
enum
nf_nat_manip_type
maniptype
);
enum
nf_nat_manip_type
maniptype
);
/* Is the manipable part of the tuple between min and max incl? */
/* Is the manipable part of the tuple between min and max incl? */
int
(
*
in_range
)(
const
struct
nf_conntrack_tuple
*
tuple
,
bool
(
*
in_range
)(
const
struct
nf_conntrack_tuple
*
tuple
,
enum
nf_nat_manip_type
maniptype
,
enum
nf_nat_manip_type
maniptype
,
const
union
nf_conntrack_man_proto
*
min
,
const
union
nf_conntrack_man_proto
*
min
,
const
union
nf_conntrack_man_proto
*
max
);
const
union
nf_conntrack_man_proto
*
max
);
/* Alter the per-proto part of the tuple (depending on
/* Alter the per-proto part of the tuple (depending on
maniptype), to give a unique tuple in the given range if
maniptype), to give a unique tuple in the given range if
possible; return false if not. Per-protocol part of tuple
possible; return false if not. Per-protocol part of tuple
is initialized to the incoming packet. */
is initialized to the incoming packet. */
int
(
*
unique_tuple
)(
struct
nf_conntrack_tuple
*
tuple
,
bool
(
*
unique_tuple
)(
struct
nf_conntrack_tuple
*
tuple
,
const
struct
nf_nat_range
*
range
,
const
struct
nf_nat_range
*
range
,
enum
nf_nat_manip_type
maniptype
,
enum
nf_nat_manip_type
maniptype
,
const
struct
nf_conn
*
ct
);
const
struct
nf_conn
*
ct
);
int
(
*
range_to_nlattr
)(
struct
sk_buff
*
skb
,
int
(
*
range_to_nlattr
)(
struct
sk_buff
*
skb
,
const
struct
nf_nat_range
*
range
);
const
struct
nf_nat_range
*
range
);
...
@@ -62,9 +59,20 @@ extern int init_protocols(void) __init;
...
@@ -62,9 +59,20 @@ extern int init_protocols(void) __init;
extern
void
cleanup_protocols
(
void
);
extern
void
cleanup_protocols
(
void
);
extern
const
struct
nf_nat_protocol
*
find_nat_proto
(
u_int16_t
protonum
);
extern
const
struct
nf_nat_protocol
*
find_nat_proto
(
u_int16_t
protonum
);
extern
int
nf_nat_port_range_to_nlattr
(
struct
sk_buff
*
skb
,
extern
bool
nf_nat_proto_in_range
(
const
struct
nf_conntrack_tuple
*
tuple
,
const
struct
nf_nat_range
*
range
);
enum
nf_nat_manip_type
maniptype
,
extern
int
nf_nat_port_nlattr_to_range
(
struct
nlattr
*
tb
[],
const
union
nf_conntrack_man_proto
*
min
,
struct
nf_nat_range
*
range
);
const
union
nf_conntrack_man_proto
*
max
);
extern
bool
nf_nat_proto_unique_tuple
(
struct
nf_conntrack_tuple
*
tuple
,
const
struct
nf_nat_range
*
range
,
enum
nf_nat_manip_type
maniptype
,
const
struct
nf_conn
*
ct
,
u_int16_t
*
rover
);
extern
int
nf_nat_proto_range_to_nlattr
(
struct
sk_buff
*
skb
,
const
struct
nf_nat_range
*
range
);
extern
int
nf_nat_proto_nlattr_to_range
(
struct
nlattr
*
tb
[],
struct
nf_nat_range
*
range
);
#endif
/*_NF_NAT_PROTO_H*/
#endif
/*_NF_NAT_PROTO_H*/
This diff is collapsed.
Click to expand it.
include/net/netfilter/nf_nat_rule.h
View file @
334f8b2a
...
@@ -14,7 +14,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,
...
@@ -14,7 +14,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,
extern
unsigned
int
extern
unsigned
int
alloc_null_binding
(
struct
nf_conn
*
ct
,
unsigned
int
hooknum
);
alloc_null_binding
(
struct
nf_conn
*
ct
,
unsigned
int
hooknum
);
extern
unsigned
int
alloc_null_binding_confirmed
(
struct
nf_conn
*
ct
,
unsigned
int
hooknum
);
#endif
/* _NF_NAT_RULE_H */
#endif
/* _NF_NAT_RULE_H */
This diff is collapsed.
Click to expand it.
net/bridge/netfilter/Kconfig
View file @
334f8b2a
...
@@ -212,4 +212,18 @@ config BRIDGE_EBT_ULOG
...
@@ -212,4 +212,18 @@ config BRIDGE_EBT_ULOG
To compile it as a module, choose M here. If unsure, say N.
To compile it as a module, choose M here. If unsure, say N.
config BRIDGE_EBT_NFLOG
tristate "ebt: nflog support"
depends on BRIDGE_NF_EBTABLES
help
This option enables the nflog watcher, which allows to LOG
messages through the netfilter logging API, which can use
either the old LOG target, the old ULOG target or nfnetlink_log
as backend.
This option adds the ulog watcher, that you can use in any rule
in any ebtables table.
To compile it as a module, choose M here. If unsure, say N.
endmenu
endmenu
This diff is collapsed.
Click to expand it.
net/bridge/netfilter/Makefile
View file @
334f8b2a
...
@@ -30,3 +30,4 @@ obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o
...
@@ -30,3 +30,4 @@ obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o
# watchers
# watchers
obj-$(CONFIG_BRIDGE_EBT_LOG)
+=
ebt_log.o
obj-$(CONFIG_BRIDGE_EBT_LOG)
+=
ebt_log.o
obj-$(CONFIG_BRIDGE_EBT_ULOG)
+=
ebt_ulog.o
obj-$(CONFIG_BRIDGE_EBT_ULOG)
+=
ebt_ulog.o
obj-$(CONFIG_BRIDGE_EBT_NFLOG)
+=
ebt_nflog.o
This diff is collapsed.
Click to expand it.
net/bridge/netfilter/ebt_nflog.c
0 → 100644
View file @
334f8b2a
/*
* ebt_nflog
*
* Author:
* Peter Warasin <peter@endian.com>
*
* February, 2008
*
* Based on:
* xt_NFLOG.c, (C) 2006 by Patrick McHardy <kaber@trash.net>
* ebt_ulog.c, (C) 2004 by Bart De Schuymer <bdschuym@pandora.be>
*
*/
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_nflog.h>
#include <net/netfilter/nf_log.h>
static
void
ebt_nflog
(
const
struct
sk_buff
*
skb
,
unsigned
int
hooknr
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
const
void
*
data
,
unsigned
int
datalen
)
{
struct
ebt_nflog_info
*
info
=
(
struct
ebt_nflog_info
*
)
data
;
struct
nf_loginfo
li
;
li
.
type
=
NF_LOG_TYPE_ULOG
;
li
.
u
.
ulog
.
copy_len
=
info
->
len
;
li
.
u
.
ulog
.
group
=
info
->
group
;
li
.
u
.
ulog
.
qthreshold
=
info
->
threshold
;
nf_log_packet
(
PF_BRIDGE
,
hooknr
,
skb
,
in
,
out
,
&
li
,
"%s"
,
info
->
prefix
);
}
static
int
ebt_nflog_check
(
const
char
*
tablename
,
unsigned
int
hookmask
,
const
struct
ebt_entry
*
e
,
void
*
data
,
unsigned
int
datalen
)
{
struct
ebt_nflog_info
*
info
=
(
struct
ebt_nflog_info
*
)
data
;
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_nflog_info
)))
return
-
EINVAL
;
if
(
info
->
flags
&
~
EBT_NFLOG_MASK
)
return
-
EINVAL
;
info
->
prefix
[
EBT_NFLOG_PREFIX_SIZE
-
1
]
=
'\0'
;
return
0
;
}
static
struct
ebt_watcher
nflog
__read_mostly
=
{
.
name
=
EBT_NFLOG_WATCHER
,
.
watcher
=
ebt_nflog
,
.
check
=
ebt_nflog_check
,
.
me
=
THIS_MODULE
,
};
static
int
__init
ebt_nflog_init
(
void
)
{
return
ebt_register_watcher
(
&
nflog
);
}
static
void
__exit
ebt_nflog_fini
(
void
)
{
ebt_unregister_watcher
(
&
nflog
);
}
module_init
(
ebt_nflog_init
);
module_exit
(
ebt_nflog_fini
);
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Peter Warasin <peter@endian.com>"
);
MODULE_DESCRIPTION
(
"ebtables NFLOG netfilter logging module"
);
This diff is collapsed.
Click to expand it.
net/bridge/netfilter/ebtable_broute.c
View file @
334f8b2a
...
@@ -46,7 +46,7 @@ static struct ebt_table broute_table =
...
@@ -46,7 +46,7 @@ static struct ebt_table broute_table =
.
name
=
"broute"
,
.
name
=
"broute"
,
.
table
=
&
initial_table
,
.
table
=
&
initial_table
,
.
valid_hooks
=
1
<<
NF_BR_BROUTING
,
.
valid_hooks
=
1
<<
NF_BR_BROUTING
,
.
lock
=
RW_LOCK_UNLOCKED
,
.
lock
=
__
RW_LOCK_UNLOCKED
(
broute_table
.
lock
)
,
.
check
=
check
,
.
check
=
check
,
.
me
=
THIS_MODULE
,
.
me
=
THIS_MODULE
,
};
};
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment