Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13639
b: refs/heads/master
c: a2506c0
h: refs/heads/master
i:
  13637: f602f27
  13635: 77c398d
  13631: 97e74a6
v: v3
  • Loading branch information
Harald Welte authored and David S. Miller committed Nov 9, 2005
1 parent 23638e8 commit 78fd27f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 47 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eaae4fa45e0f4cd1da0f00ae93551edb1002b2b9
refs/heads/master: a2506c04322ca266fe2f9bd7d02a67b1972da611
2 changes: 1 addition & 1 deletion trunk/include/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ extern void nfnl_unlock(void);
extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);

extern int nfattr_parse(struct nfattr *tb[], int maxattr,
extern void nfattr_parse(struct nfattr *tb[], int maxattr,
struct nfattr *nfa, int len);

#define nfattr_parse_nested(tb, max, nfa) \
Expand Down
45 changes: 8 additions & 37 deletions trunk/net/ipv4/netfilter/ip_conntrack_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,7 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)

DEBUGP("entered %s\n", __FUNCTION__);


if (nfattr_parse_nested(tb, CTA_IP_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_IP_MAX, attr);

if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
return -EINVAL;
Expand All @@ -500,9 +498,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
DEBUGP("leaving\n");

return 0;

nfattr_failure:
return -1;
}

static const int cta_min_proto[CTA_PROTO_MAX] = {
Expand All @@ -524,8 +519,7 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,

DEBUGP("entered %s\n", __FUNCTION__);

if (nfattr_parse_nested(tb, CTA_PROTO_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);

if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
return -EINVAL;
Expand All @@ -542,9 +536,6 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
}

return ret;

nfattr_failure:
return -1;
}

static inline int
Expand All @@ -558,8 +549,7 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,

memset(tuple, 0, sizeof(*tuple));

if (nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);

if (!tb[CTA_TUPLE_IP-1])
return -EINVAL;
Expand All @@ -586,9 +576,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,
DEBUGP("leaving\n");

return 0;

nfattr_failure:
return -1;
}

#ifdef CONFIG_IP_NF_NAT_NEEDED
Expand All @@ -606,11 +593,10 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,

DEBUGP("entered %s\n", __FUNCTION__);

if (nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);

if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
goto nfattr_failure;
return -1;

npt = ip_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum);
if (!npt)
Expand All @@ -629,9 +615,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,

DEBUGP("leaving\n");
return 0;

nfattr_failure:
return -1;
}

static inline int
Expand All @@ -645,8 +628,7 @@ ctnetlink_parse_nat(struct nfattr *cda[],

memset(range, 0, sizeof(*range));

if (nfattr_parse_nested(tb, CTA_NAT_MAX, cda[CTA_NAT-1]) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_NAT_MAX, cda[CTA_NAT-1]);

if (tb[CTA_NAT_MINIP-1])
range->min_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MINIP-1]);
Expand All @@ -668,9 +650,6 @@ ctnetlink_parse_nat(struct nfattr *cda[],

DEBUGP("leaving\n");
return 0;

nfattr_failure:
return -1;
}
#endif

Expand All @@ -681,18 +660,14 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)

DEBUGP("entered %s\n", __FUNCTION__);

if (nfattr_parse_nested(tb, CTA_HELP_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_HELP_MAX, attr);

if (!tb[CTA_HELP_NAME-1])
return -EINVAL;

*helper_name = NFA_DATA(tb[CTA_HELP_NAME-1]);

return 0;

nfattr_failure:
return -1;
}

static int
Expand Down Expand Up @@ -960,8 +935,7 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
u_int16_t npt = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
int err = 0;

if (nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr);

proto = ip_conntrack_proto_find_get(npt);
if (!proto)
Expand All @@ -972,9 +946,6 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
ip_conntrack_proto_put(proto);

return err;

nfattr_failure:
return -ENOMEM;
}

static int
Expand Down
6 changes: 1 addition & 5 deletions trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct)
struct nfattr *attr = cda[CTA_PROTOINFO_TCP-1];
struct nfattr *tb[CTA_PROTOINFO_TCP_MAX];

if (nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr) < 0)
goto nfattr_failure;
nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr);

if (!tb[CTA_PROTOINFO_TCP_STATE-1])
return -EINVAL;
Expand All @@ -374,9 +373,6 @@ static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct)
write_unlock_bh(&tcp_lock);

return 0;

nfattr_failure:
return -1;
}
#endif

Expand Down
4 changes: 1 addition & 3 deletions trunk/net/netfilter/nfnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void __nfa_fill(struct sk_buff *skb, int attrtype, int attrlen,
memset(NFA_DATA(nfa) + attrlen, 0, NFA_ALIGN(size) - size);
}

int nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len)
void nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len)
{
memset(tb, 0, sizeof(struct nfattr *) * maxattr);

Expand All @@ -138,8 +138,6 @@ int nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len)
tb[flavor-1] = nfa;
nfa = NFA_NEXT(nfa, len);
}

return 0;
}

/**
Expand Down

0 comments on commit 78fd27f

Please sign in to comment.