Commit 1ae14212 authored by Rusty Russell's avatar Rusty Russell Committed by David S. Miller

[NETFILTER]: Remove remaining multirange related code

From: KOVACS Krisztian <hidden@sch.bme.hu>

  Hi Rusty,

Your recent patch which removed the byipsproto hash left some unused
code around. The following patch cleans up that. I'm not sure it's
correct, but please take a look at it.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0cac7232
...@@ -16,8 +16,6 @@ enum ip_nat_manip_type ...@@ -16,8 +16,6 @@ enum ip_nat_manip_type
#define IP_NAT_RANGE_MAP_IPS 1 #define IP_NAT_RANGE_MAP_IPS 1
#define IP_NAT_RANGE_PROTO_SPECIFIED 2 #define IP_NAT_RANGE_PROTO_SPECIFIED 2
/* Used internally by get_unique_tuple(). */
#define IP_NAT_RANGE_FULL 4
/* NAT sequence number modifications */ /* NAT sequence number modifications */
struct ip_nat_seq { struct ip_nat_seq {
...@@ -51,7 +49,7 @@ struct ip_nat_multi_range_compat ...@@ -51,7 +49,7 @@ struct ip_nat_multi_range_compat
}; };
/* Worst case: local-out manip + 1 post-routing, and reverse dirn. */ /* Worst case: local-out manip + 1 post-routing, and reverse dirn. */
#define IP_NAT_MAX_MANIPS (2*3) #define IP_NAT_MAX_MANIPS (2*2)
struct ip_nat_info_manip struct ip_nat_info_manip
{ {
......
...@@ -51,15 +51,7 @@ static struct list_head *bysource; ...@@ -51,15 +51,7 @@ static struct list_head *bysource;
struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO];
/* We keep extra hashes for each conntrack, for fast searching. */ /* We keep an extra hash for each conntrack, for fast searching. */
static inline size_t
hash_by_ipsproto(u_int32_t src, u_int32_t dst, u_int16_t proto)
{
/* Modified src and dst, to ensure we don't create two
identical streams. */
return (src + dst + proto) % ip_nat_htable_size;
}
static inline size_t static inline size_t
hash_by_src(const struct ip_conntrack_manip *manip, u_int16_t proto) hash_by_src(const struct ip_conntrack_manip *manip, u_int16_t proto)
{ {
...@@ -71,7 +63,7 @@ hash_by_src(const struct ip_conntrack_manip *manip, u_int16_t proto) ...@@ -71,7 +63,7 @@ hash_by_src(const struct ip_conntrack_manip *manip, u_int16_t proto)
static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn) static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn)
{ {
struct ip_nat_info *info = &conn->nat.info; struct ip_nat_info *info = &conn->nat.info;
unsigned int hs, hp; unsigned int hs;
if (!info->initialized) if (!info->initialized)
return; return;
...@@ -80,11 +72,6 @@ static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn) ...@@ -80,11 +72,6 @@ static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn)
conn->tuplehash[IP_CT_DIR_ORIGINAL] conn->tuplehash[IP_CT_DIR_ORIGINAL]
.tuple.dst.protonum); .tuple.dst.protonum);
hp = hash_by_ipsproto(conn->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip,
conn->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip,
conn->tuplehash[IP_CT_DIR_REPLY]
.tuple.dst.protonum);
WRITE_LOCK(&ip_nat_lock); WRITE_LOCK(&ip_nat_lock);
list_del(&info->bysource); list_del(&info->bysource);
WRITE_UNLOCK(&ip_nat_lock); WRITE_UNLOCK(&ip_nat_lock);
...@@ -336,15 +323,13 @@ ip_nat_setup_info(struct ip_conntrack *conntrack, ...@@ -336,15 +323,13 @@ ip_nat_setup_info(struct ip_conntrack *conntrack,
DUMP_TUPLE(&orig_tp); DUMP_TUPLE(&orig_tp);
DEBUGP("Range %p: ", mr); DEBUGP("Range %p: ", mr);
for (i = 0; i < mr->rangesize; i++) { for (i = 0; i < mr->rangesize; i++) {
DEBUGP("%u:%s%s%s %u.%u.%u.%u - %u.%u.%u.%u %u - %u\n", DEBUGP("%u:%s%s %u.%u.%u.%u - %u.%u.%u.%u %u - %u\n",
i, i,
(mr->range[i].flags & IP_NAT_RANGE_MAP_IPS) (mr->range[i].flags & IP_NAT_RANGE_MAP_IPS)
? " MAP_IPS" : "", ? " MAP_IPS" : "",
(mr->range[i].flags (mr->range[i].flags
& IP_NAT_RANGE_PROTO_SPECIFIED) & IP_NAT_RANGE_PROTO_SPECIFIED)
? " PROTO_SPECIFIED" : "", ? " PROTO_SPECIFIED" : "",
(mr->range[i].flags & IP_NAT_RANGE_FULL)
? " FULL" : "",
NIPQUAD(mr->range[i].min_ip), NIPQUAD(mr->range[i].min_ip),
NIPQUAD(mr->range[i].max_ip), NIPQUAD(mr->range[i].max_ip),
mr->range[i].min.all, mr->range[i].min.all,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment