History

netfilter: remove nf_ct_is_untracked

This function is now obsolete and always returns false. This change has no effect on generated code.

Florian Westphal committed 9 years ago

Commit ab8bc7e1 parent cc41c8416 files · +17 −49Browse files

Unified · Split

16 files
  1. include/net/ip_vs.h +2 −2
  2. include/net/netfilter/nf_conntrack.h +0 −5
  3. include/net/netfilter/nf_conntrack_core.h +1 −1
  4. net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +0 −4
  5. net/ipv4/netfilter/nf_socket_ipv4.c +1 −1
  6. net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +0 −4
  7. net/netfilter/ipvs/ip_vs_ftp.c +1 −2
  8. net/netfilter/ipvs/ip_vs_nfct.c +2 −2
  9. net/netfilter/ipvs/ip_vs_xmit.c +4 −4
  10. net/netfilter/nf_conntrack_netlink.c +1 −11
  11. net/netfilter/xt_HMARK.c +1 −1
  12. net/netfilter/xt_cluster.c +0 −3
  13. net/netfilter/xt_connlabel.c +1 −1
  14. net/netfilter/xt_connmark.c +2 −2
  15. net/netfilter/xt_ipvs.c +1 −1
  16. net/openvswitch/conntrack.c +0 −5
include/net/ip_vs.h+2−2
@@ -1555,7 +1555,7 @@ static inline void ip_vs_notrack(struct sk_buff *skb) · 1554 unmodified lines
15551555 enum ip_conntrack_info ctinfo;
15561556 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
15571557
1558− if (!ct || !nf_ct_is_untracked(ct)) {
1558+ if (ct) {
15591559 nf_conntrack_put(&ct->ct_general);
15601560 nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
15611561 }
@@ -1616,7 +1616,7 @@ static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, · 54 unmodified lines
16161616 if (!(cp->flags & IP_VS_CONN_F_NFCT))
16171617 return false;
16181618 ct = nf_ct_get(skb, &ctinfo);
1619− if (ct && !nf_ct_is_untracked(ct))
1619+ if (ct)
16201620 return true;
16211621 #endif
16221622 return false;
include/net/netfilter/nf_conntrack.h+0−5
@@ -273,11 +273,6 @@ static inline int nf_ct_is_dying(const struct nf_conn *ct) · 272 unmodified lines
273273 return test_bit(IPS_DYING_BIT, &ct->status);
274274 }
275275
276−static inline int nf_ct_is_untracked(const struct nf_conn *ct)
277−{
278− return false;
279−}
280−
281276 /* Packet is received from loopback */
282277 static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
283278 {
include/net/netfilter/nf_conntrack_core.h+1−1
@@ -65,7 +65,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) · 64 unmodified lines
6565 struct nf_conn *ct = (struct nf_conn *)skb_nfct(skb);
6666 int ret = NF_ACCEPT;
6767
68− if (ct && !nf_ct_is_untracked(ct)) {
68+ if (ct) {
6969 if (!nf_ct_is_confirmed(ct))
7070 ret = __nf_conntrack_confirm(skb);
7171 if (likely(ret == NF_ACCEPT))
net/ipv4/netfilter/nf_nat_l3proto_ipv4.c+0−4
@@ -264,10 +264,6 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, · 263 unmodified lines
264264 if (!ct)
265265 return NF_ACCEPT;
266266
267− /* Don't try to NAT if this packet is not conntracked */
268− if (nf_ct_is_untracked(ct))
269− return NF_ACCEPT;
270−
271267 nat = nf_ct_nat_ext_add(ct);
272268 if (nat == NULL)
273269 return NF_ACCEPT;
net/ipv4/netfilter/nf_socket_ipv4.c+1−1
@@ -139,7 +139,7 @@ struct sock *nf_sk_lookup_slow_v4(struct net *net, const struct sk_buff *skb, · 138 unmodified lines
139139 * SNAT-ted connection.
140140 */
141141 ct = nf_ct_get(skb, &ctinfo);
142− if (ct && !nf_ct_is_untracked(ct) &&
142+ if (ct &&
143143 ((iph->protocol != IPPROTO_ICMP &&
144144 ctinfo == IP_CT_ESTABLISHED_REPLY) ||
145145 (iph->protocol == IPPROTO_ICMP &&
net/ipv6/netfilter/nf_nat_l3proto_ipv6.c+0−4
@@ -273,10 +273,6 @@ nf_nat_ipv6_fn(void *priv, struct sk_buff *skb, · 272 unmodified lines
273273 if (!ct)
274274 return NF_ACCEPT;
275275
276− /* Don't try to NAT if this packet is not conntracked */
277− if (nf_ct_is_untracked(ct))
278− return NF_ACCEPT;
279−
280276 nat = nf_ct_nat_ext_add(ct);
281277 if (nat == NULL)
282278 return NF_ACCEPT;
net/netfilter/ipvs/ip_vs_ftp.c+1−2
@@ -260,9 +260,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, · 259 unmodified lines
260260 buf_len = strlen(buf);
261261
262262 ct = nf_ct_get(skb, &ctinfo);
263− if (ct && !nf_ct_is_untracked(ct) && (ct->status & IPS_NAT_MASK)) {
263+ if (ct && nfct_nat(ct)) {
264264 bool mangled;
265−
266265 /* If mangling fails this function will return 0
267266 * which will cause the packet to be dropped.
268267 * Mangling can only fail under memory pressure,
net/netfilter/ipvs/ip_vs_nfct.c+2−2
@@ -85,7 +85,7 @@ ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin) · 84 unmodified lines
8585 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
8686 struct nf_conntrack_tuple new_tuple;
8787
88− if (ct == NULL || nf_ct_is_confirmed(ct) || nf_ct_is_untracked(ct) ||
88+ if (ct == NULL || nf_ct_is_confirmed(ct) ||
8989 nf_ct_is_dying(ct))
9090 return;
9191
@@ -232,7 +232,7 @@ void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, · 140 unmodified lines
232232 {
233233 struct nf_conntrack_expect *exp;
234234
235− if (ct == NULL || nf_ct_is_untracked(ct))
235+ if (ct == NULL)
236236 return;
237237
238238 exp = nf_ct_expect_alloc(ct);
net/netfilter/ipvs/ip_vs_xmit.c+4−4
@@ -775,7 +775,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, · 774 unmodified lines
775775 enum ip_conntrack_info ctinfo;
776776 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
777777
778− if (ct && !nf_ct_is_untracked(ct)) {
778+ if (ct) {
779779 IP_VS_DBG_RL_PKT(10, AF_INET, pp, skb, ipvsh->off,
780780 "ip_vs_nat_xmit(): "
781781 "stopping DNAT to local address");
@@ -866,7 +866,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, · 84 unmodified lines
866866 enum ip_conntrack_info ctinfo;
867867 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
868868
869− if (ct && !nf_ct_is_untracked(ct)) {
869+ if (ct) {
870870 IP_VS_DBG_RL_PKT(10, AF_INET6, pp, skb, ipvsh->off,
871871 "ip_vs_nat_xmit_v6(): "
872872 "stopping DNAT to local address");
@@ -1338,7 +1338,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, · 465 unmodified lines
13381338 enum ip_conntrack_info ctinfo;
13391339 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
13401340
1341− if (ct && !nf_ct_is_untracked(ct)) {
1341+ if (ct) {
13421342 IP_VS_DBG(10, "%s(): "
13431343 "stopping DNAT to local address %pI4\n",
13441344 __func__, &cp->daddr.ip);
@@ -1429,7 +1429,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, · 84 unmodified lines
14291429 enum ip_conntrack_info ctinfo;
14301430 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
14311431
1432− if (ct && !nf_ct_is_untracked(ct)) {
1432+ if (ct) {
14331433 IP_VS_DBG(10, "%s(): "
14341434 "stopping DNAT to local address %pI6\n",
14351435 __func__, &cp->daddr.in6);
net/netfilter/nf_conntrack_netlink.c+1−11
@@ -627,10 +627,6 @@ ctnetlink_conntrack_event(unsigned int events, struct nf_ct_event *item) · 626 unmodified lines
627627 unsigned int flags = 0, group;
628628 int err;
629629
630− /* ignore our fake conntrack entry */
631− if (nf_ct_is_untracked(ct))
632− return 0;
633−
634630 if (events & (1 << IPCT_DESTROY)) {
635631 type = IPCTNL_MSG_CT_DELETE;
636632 group = NFNLGRP_CONNTRACK_DESTROY;
@@ -2173,13 +2169,7 @@ ctnetlink_glue_build_size(const struct nf_conn *ct) · 1536 unmodified lines
21732169 static struct nf_conn *ctnetlink_glue_get_ct(const struct sk_buff *skb,
21742170 enum ip_conntrack_info *ctinfo)
21752171 {
2176− struct nf_conn *ct;
2177−
2178− ct = nf_ct_get(skb, ctinfo);
2179− if (ct && nf_ct_is_untracked(ct))
2180− ct = NULL;
2181−
2182− return ct;
2172+ return nf_ct_get(skb, ctinfo);
21832173 }
21842174
21852175 static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
net/netfilter/xt_HMARK.c+1−1
@@ -84,7 +84,7 @@ hmark_ct_set_htuple(const struct sk_buff *skb, struct hmark_tuple *t, · 83 unmodified lines
8484 struct nf_conntrack_tuple *otuple;
8585 struct nf_conntrack_tuple *rtuple;
8686
87− if (ct == NULL || nf_ct_is_untracked(ct))
87+ if (ct == NULL)
8888 return -1;
8989
9090 otuple = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
net/netfilter/xt_cluster.c+0−3
@@ -121,9 +121,6 @@ xt_cluster_mt(const struct sk_buff *skb, struct xt_action_param *par) · 120 unmodified lines
121121 if (ct == NULL)
122122 return false;
123123
124− if (nf_ct_is_untracked(ct))
125− return false;
126−
127124 if (ct->master)
128125 hash = xt_cluster_hash(ct->master, info);
129126 else
net/netfilter/xt_connlabel.c+1−1
@@ -29,7 +29,7 @@ connlabel_mt(const struct sk_buff *skb, struct xt_action_param *par) · 28 unmodified lines
2929 bool invert = info->options & XT_CONNLABEL_OP_INVERT;
3030
3131 ct = nf_ct_get(skb, &ctinfo);
32− if (ct == NULL || nf_ct_is_untracked(ct))
32+ if (ct == NULL)
3333 return invert;
3434
3535 labels = nf_ct_labels_find(ct);
net/netfilter/xt_connmark.c+2−2
@@ -44,7 +44,7 @@ connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) · 43 unmodified lines
4444 u_int32_t newmark;
4545
4646 ct = nf_ct_get(skb, &ctinfo);
47− if (ct == NULL || nf_ct_is_untracked(ct))
47+ if (ct == NULL)
4848 return XT_CONTINUE;
4949
5050 switch (info->mode) {
@@ -97,7 +97,7 @@ connmark_mt(const struct sk_buff *skb, struct xt_action_param *par) · 46 unmodified lines
9797 const struct nf_conn *ct;
9898
9999 ct = nf_ct_get(skb, &ctinfo);
100− if (ct == NULL || nf_ct_is_untracked(ct))
100+ if (ct == NULL)
101101 return false;
102102
103103 return ((ct->mark & info->mask) == info->mark) ^ info->invert;
net/netfilter/xt_ipvs.c+1−1
@@ -116,7 +116,7 @@ ipvs_mt(const struct sk_buff *skb, struct xt_action_param *par) · 115 unmodified lines
116116 enum ip_conntrack_info ctinfo;
117117 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
118118
119− if (ct == NULL || nf_ct_is_untracked(ct)) {
119+ if (ct == NULL) {
120120 match = false;
121121 goto out_put_cp;
122122 }
net/openvswitch/conntrack.c+0−5
@@ -795,11 +795,6 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, · 794 unmodified lines
795795 enum nf_nat_manip_type maniptype;
796796 int err;
797797
798− if (nf_ct_is_untracked(ct)) {
799− /* A NAT action may only be performed on tracked packets. */
800− return NF_ACCEPT;
801− }
802−
803798 /* Add NAT extension if not confirmed yet. */
804799 if (!nf_ct_is_confirmed(ct) && !nf_ct_nat_ext_add(ct))
805800 return NF_ACCEPT; /* Can't NAT. */