Skip to content

Commit

Permalink
Merge branch 'nf-next' of git://1984.lsi.us.es/net-next
Browse files Browse the repository at this point in the history
  • Loading branch information
davem330 committed Dec 25, 2011
2 parents 60b778c + ceb98d0 commit c5e1fd8
Show file tree
Hide file tree
Showing 59 changed files with 1,168 additions and 378 deletions.
3 changes: 3 additions & 0 deletions include/linux/netfilter/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ header-y += nf_conntrack_ftp.h
header-y += nf_conntrack_sctp.h
header-y += nf_conntrack_tcp.h
header-y += nf_conntrack_tuple_common.h
header-y += nf_nat.h
header-y += nfnetlink.h
header-y += nfnetlink_acct.h
header-y += nfnetlink_compat.h
header-y += nfnetlink_conntrack.h
header-y += nfnetlink_log.h
Expand All @@ -21,6 +23,7 @@ header-y += xt_DSCP.h
header-y += xt_IDLETIMER.h
header-y += xt_LED.h
header-y += xt_MARK.h
header-y += xt_nfacct.h
header-y += xt_NFLOG.h
header-y += xt_NFQUEUE.h
header-y += xt_RATEEST.h
Expand Down
4 changes: 4 additions & 0 deletions include/linux/netfilter/nf_conntrack_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ enum ip_conntrack_status {
/* Conntrack is a fake untracked entry */
IPS_UNTRACKED_BIT = 12,
IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),

/* Conntrack has a userspace helper. */
IPS_USERSPACE_HELPER_BIT = 13,
IPS_USERSPACE_HELPER = (1 << IPS_USERSPACE_HELPER_BIT),
};

/* Connection tracking event types */
Expand Down
27 changes: 27 additions & 0 deletions include/linux/netfilter/nf_conntrack_tuple_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ enum ip_conntrack_dir {
IP_CT_DIR_MAX
};

/* The protocol-specific manipulable parts of the tuple: always in
* network order
*/
union nf_conntrack_man_proto {
/* Add other protocols here. */
__be16 all;

struct {
__be16 port;
} tcp;
struct {
__be16 port;
} udp;
struct {
__be16 id;
} icmp;
struct {
__be16 port;
} dccp;
struct {
__be16 port;
} sctp;
struct {
__be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
} gre;
};

#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)

#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
25 changes: 25 additions & 0 deletions include/linux/netfilter/nf_nat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef _NETFILTER_NF_NAT_H
#define _NETFILTER_NF_NAT_H

#include <linux/netfilter.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>

#define NF_NAT_RANGE_MAP_IPS 1
#define NF_NAT_RANGE_PROTO_SPECIFIED 2
#define NF_NAT_RANGE_PROTO_RANDOM 4
#define NF_NAT_RANGE_PERSISTENT 8

struct nf_nat_ipv4_range {
unsigned int flags;
__be32 min_ip;
__be32 max_ip;
union nf_conntrack_man_proto min;
union nf_conntrack_man_proto max;
};

struct nf_nat_ipv4_multi_range_compat {
unsigned int rangesize;
struct nf_nat_ipv4_range range[1];
};

#endif /* _NETFILTER_NF_NAT_H */
3 changes: 2 additions & 1 deletion include/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ struct nfgenmsg {
#define NFNL_SUBSYS_ULOG 4
#define NFNL_SUBSYS_OSF 5
#define NFNL_SUBSYS_IPSET 6
#define NFNL_SUBSYS_COUNT 7
#define NFNL_SUBSYS_ACCT 7
#define NFNL_SUBSYS_COUNT 8

#ifdef __KERNEL__

Expand Down
36 changes: 36 additions & 0 deletions include/linux/netfilter/nfnetlink_acct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef _NFNL_ACCT_H_
#define _NFNL_ACCT_H_

#ifndef NFACCT_NAME_MAX
#define NFACCT_NAME_MAX 32
#endif

enum nfnl_acct_msg_types {
NFNL_MSG_ACCT_NEW,
NFNL_MSG_ACCT_GET,
NFNL_MSG_ACCT_GET_CTRZERO,
NFNL_MSG_ACCT_DEL,
NFNL_MSG_ACCT_MAX
};

enum nfnl_acct_type {
NFACCT_UNSPEC,
NFACCT_NAME,
NFACCT_PKTS,
NFACCT_BYTES,
NFACCT_USE,
__NFACCT_MAX
};
#define NFACCT_MAX (__NFACCT_MAX - 1)

#ifdef __KERNEL__

struct nf_acct;

extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
extern void nfnl_acct_put(struct nf_acct *acct);
extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);

#endif /* __KERNEL__ */

#endif /* _NFNL_ACCT_H */
3 changes: 2 additions & 1 deletion include/linux/netfilter/xt_CT.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include <linux/types.h>

#define XT_CT_NOTRACK 0x1
#define XT_CT_NOTRACK 0x1
#define XT_CT_USERSPACE_HELPER 0x2

struct xt_ct_target_info {
__u16 flags;
Expand Down
13 changes: 13 additions & 0 deletions include/linux/netfilter/xt_nfacct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _XT_NFACCT_MATCH_H
#define _XT_NFACCT_MATCH_H

#include <linux/netfilter/nfnetlink_acct.h>

struct nf_acct;

struct xt_nfacct_match_info {
char name[NFACCT_NAME_MAX];
struct nf_acct *nfacct;
};

#endif /* _XT_NFACCT_MATCH_H */
23 changes: 23 additions & 0 deletions include/linux/netfilter/xt_rpfilter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef _XT_RPATH_H
#define _XT_RPATH_H

#include <linux/types.h>

enum {
XT_RPFILTER_LOOSE = 1 << 0,
XT_RPFILTER_VALID_MARK = 1 << 1,
XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
XT_RPFILTER_INVERT = 1 << 3,
#ifdef __KERNEL__
XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
XT_RPFILTER_VALID_MARK |
XT_RPFILTER_ACCEPT_LOCAL |
XT_RPFILTER_INVERT,
#endif
};

struct xt_rpfilter_info {
__u8 flags;
};

#endif
1 change: 0 additions & 1 deletion include/linux/netfilter_ipv4/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ header-y += ipt_ah.h
header-y += ipt_ecn.h
header-y += ipt_realm.h
header-y += ipt_ttl.h
header-y += nf_nat.h
58 changes: 0 additions & 58 deletions include/linux/netfilter_ipv4/nf_nat.h

This file was deleted.

2 changes: 2 additions & 0 deletions include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ extern void ip6_route_input(struct sk_buff *skb);
extern struct dst_entry * ip6_route_output(struct net *net,
const struct sock *sk,
struct flowi6 *fl6);
extern struct dst_entry * ip6_route_lookup(struct net *net,
struct flowi6 *fl6, int flags);

extern int ip6_route_init(void);
extern void ip6_route_cleanup(void);
Expand Down
4 changes: 2 additions & 2 deletions include/net/netfilter/nf_conntrack_acct.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <net/netfilter/nf_conntrack_extend.h>

struct nf_conn_counter {
u_int64_t packets;
u_int64_t bytes;
atomic64_t packets;
atomic64_t bytes;
};

static inline
Expand Down
1 change: 0 additions & 1 deletion include/net/netfilter/nf_conntrack_expect.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)

void nf_ct_remove_expectations(struct nf_conn *ct);
void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
void nf_ct_remove_userspace_expectations(void);

/* Allocate space for an expectation: this is mandatory before calling
nf_ct_expect_related. You will have to call put afterwards. */
Expand Down
1 change: 0 additions & 1 deletion include/net/netfilter/nf_conntrack_tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>
#include <linux/netfilter_ipv4/nf_nat.h>
#include <linux/list_nulls.h>

/* A `tuple' is a structure containing the information to uniquely
Expand Down
10 changes: 4 additions & 6 deletions include/net/netfilter/nf_nat.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#ifndef _NF_NAT_H
#define _NF_NAT_H
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4/nf_nat.h>
#include <linux/netfilter/nf_nat.h>
#include <net/netfilter/nf_conntrack_tuple.h>

#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16

enum nf_nat_manip_type {
IP_NAT_MANIP_SRC,
IP_NAT_MANIP_DST
NF_NAT_MANIP_SRC,
NF_NAT_MANIP_DST
};

/* SRC manip occurs POST_ROUTING or LOCAL_IN */
Expand Down Expand Up @@ -52,7 +50,7 @@ struct nf_conn_nat {

/* Set up the info structure to map into this range. */
extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
const struct nf_nat_range *range,
const struct nf_nat_ipv4_range *range,
enum nf_nat_manip_type maniptype);

/* Is this tuple already taken? (not by us)*/
Expand Down
2 changes: 1 addition & 1 deletion include/net/netfilter/nf_nat_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern int nf_nat_icmp_reply_translation(struct nf_conn *ct,
static inline int nf_nat_initialized(struct nf_conn *ct,
enum nf_nat_manip_type manip)
{
if (manip == IP_NAT_MANIP_SRC)
if (manip == NF_NAT_MANIP_SRC)
return ct->status & IPS_SRC_NAT_DONE;
else
return ct->status & IPS_DST_NAT_DONE;
Expand Down
17 changes: 5 additions & 12 deletions include/net/netfilter/nf_nat_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
#include <net/netfilter/nf_nat.h>
#include <linux/netfilter/nfnetlink_conntrack.h>

struct nf_nat_range;
struct nf_nat_ipv4_range;

struct nf_nat_protocol {
/* Protocol number. */
unsigned int protonum;

struct module *me;

/* Translate a packet to the target according to manip type.
Return true if succeeded. */
bool (*manip_pkt)(struct sk_buff *skb,
Expand All @@ -30,15 +28,12 @@ struct nf_nat_protocol {
possible. Per-protocol part of tuple is initialized to the
incoming packet. */
void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
const struct nf_nat_range *range,
const struct nf_nat_ipv4_range *range,
enum nf_nat_manip_type maniptype,
const struct nf_conn *ct);

int (*range_to_nlattr)(struct sk_buff *skb,
const struct nf_nat_range *range);

int (*nlattr_to_range)(struct nlattr *tb[],
struct nf_nat_range *range);
struct nf_nat_ipv4_range *range);
};

/* Protocol registration. */
Expand All @@ -61,14 +56,12 @@ extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
const union nf_conntrack_man_proto *max);

extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
const struct nf_nat_range *range,
const struct nf_nat_ipv4_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);
struct nf_nat_ipv4_range *range);

#endif /*_NF_NAT_PROTO_H*/
1 change: 1 addition & 0 deletions net/ipv4/fib_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ int fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res)

return err;
}
EXPORT_SYMBOL_GPL(fib_lookup);

static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp,
int flags, struct fib_lookup_arg *arg)
Expand Down
1 change: 1 addition & 0 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
rcu_read_unlock();
return ret;
}
EXPORT_SYMBOL_GPL(fib_table_lookup);

/*
* Remove the leaf and return parent.
Expand Down
Loading

0 comments on commit c5e1fd8

Please sign in to comment.