aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netfilter/nf_conntrack_ecache.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/net/netfilter/nf_conntrack_ecache.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/net/netfilter/nf_conntrack_ecache.h')
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h52
1 files changed, 25 insertions, 27 deletions
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 5654d292efd..4283508b3e1 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,8 +17,7 @@ struct nf_conntrack_ecache {
17 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
18 u16 ctmask; /* bitmask of ct events to be delivered */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */ 19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 portid; /* netlink portid of destroyer */ 20 u32 pid; /* netlink pid of destroyer */
21 struct timer_list timeout;
22}; 21};
23 22
24static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
@@ -60,7 +59,7 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
60/* This structure is passed to event handler */ 59/* This structure is passed to event handler */
61struct nf_ct_event { 60struct nf_ct_event {
62 struct nf_conn *ct; 61 struct nf_conn *ct;
63 u32 portid; 62 u32 pid;
64 int report; 63 int report;
65}; 64};
66 65
@@ -68,18 +67,18 @@ struct nf_ct_event_notifier {
68 int (*fcn)(unsigned int events, struct nf_ct_event *item); 67 int (*fcn)(unsigned int events, struct nf_ct_event *item);
69}; 68};
70 69
71extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); 70extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
72extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); 71extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb);
72extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb);
73 73
74extern void nf_ct_deliver_cached_events(struct nf_conn *ct); 74extern void nf_ct_deliver_cached_events(struct nf_conn *ct);
75 75
76static inline void 76static inline void
77nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 77nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
78{ 78{
79 struct net *net = nf_ct_net(ct);
80 struct nf_conntrack_ecache *e; 79 struct nf_conntrack_ecache *e;
81 80
82 if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) 81 if (nf_conntrack_event_cb == NULL)
83 return; 82 return;
84 83
85 e = nf_ct_ecache_find(ct); 84 e = nf_ct_ecache_find(ct);
@@ -92,16 +91,15 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
92static inline int 91static inline int
93nf_conntrack_eventmask_report(unsigned int eventmask, 92nf_conntrack_eventmask_report(unsigned int eventmask,
94 struct nf_conn *ct, 93 struct nf_conn *ct,
95 u32 portid, 94 u32 pid,
96 int report) 95 int report)
97{ 96{
98 int ret = 0; 97 int ret = 0;
99 struct net *net = nf_ct_net(ct);
100 struct nf_ct_event_notifier *notify; 98 struct nf_ct_event_notifier *notify;
101 struct nf_conntrack_ecache *e; 99 struct nf_conntrack_ecache *e;
102 100
103 rcu_read_lock(); 101 rcu_read_lock();
104 notify = rcu_dereference(net->ct.nf_conntrack_event_cb); 102 notify = rcu_dereference(nf_conntrack_event_cb);
105 if (notify == NULL) 103 if (notify == NULL)
106 goto out_unlock; 104 goto out_unlock;
107 105
@@ -112,11 +110,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) { 110 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
113 struct nf_ct_event item = { 111 struct nf_ct_event item = {
114 .ct = ct, 112 .ct = ct,
115 .portid = e->portid ? e->portid : portid, 113 .pid = e->pid ? e->pid : pid,
116 .report = report 114 .report = report
117 }; 115 };
118 /* This is a resent of a destroy event? If so, skip missed */ 116 /* This is a resent of a destroy event? If so, skip missed */
119 unsigned long missed = e->portid ? 0 : e->missed; 117 unsigned long missed = e->pid ? 0 : e->missed;
120 118
121 if (!((eventmask | missed) & e->ctmask)) 119 if (!((eventmask | missed) & e->ctmask))
122 goto out_unlock; 120 goto out_unlock;
@@ -126,11 +124,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
126 spin_lock_bh(&ct->lock); 124 spin_lock_bh(&ct->lock);
127 if (ret < 0) { 125 if (ret < 0) {
128 /* This is a destroy event that has been 126 /* This is a destroy event that has been
129 * triggered by a process, we store the PORTID 127 * triggered by a process, we store the PID
130 * to include it in the retransmission. */ 128 * to include it in the retransmission. */
131 if (eventmask & (1 << IPCT_DESTROY) && 129 if (eventmask & (1 << IPCT_DESTROY) &&
132 e->portid == 0 && portid != 0) 130 e->pid == 0 && pid != 0)
133 e->portid = portid; 131 e->pid = pid;
134 else 132 else
135 e->missed |= eventmask; 133 e->missed |= eventmask;
136 } else 134 } else
@@ -145,9 +143,9 @@ out_unlock:
145 143
146static inline int 144static inline int
147nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, 145nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
148 u32 portid, int report) 146 u32 pid, int report)
149{ 147{
150 return nf_conntrack_eventmask_report(1 << event, ct, portid, report); 148 return nf_conntrack_eventmask_report(1 << event, ct, pid, report);
151} 149}
152 150
153static inline int 151static inline int
@@ -158,7 +156,7 @@ nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
158 156
159struct nf_exp_event { 157struct nf_exp_event {
160 struct nf_conntrack_expect *exp; 158 struct nf_conntrack_expect *exp;
161 u32 portid; 159 u32 pid;
162 int report; 160 int report;
163}; 161};
164 162
@@ -166,21 +164,21 @@ struct nf_exp_event_notifier {
166 int (*fcn)(unsigned int events, struct nf_exp_event *item); 164 int (*fcn)(unsigned int events, struct nf_exp_event *item);
167}; 165};
168 166
169extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); 167extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
170extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); 168extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb);
169extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb);
171 170
172static inline void 171static inline void
173nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 172nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
174 struct nf_conntrack_expect *exp, 173 struct nf_conntrack_expect *exp,
175 u32 portid, 174 u32 pid,
176 int report) 175 int report)
177{ 176{
178 struct net *net = nf_ct_exp_net(exp);
179 struct nf_exp_event_notifier *notify; 177 struct nf_exp_event_notifier *notify;
180 struct nf_conntrack_ecache *e; 178 struct nf_conntrack_ecache *e;
181 179
182 rcu_read_lock(); 180 rcu_read_lock();
183 notify = rcu_dereference(net->ct.nf_expect_event_cb); 181 notify = rcu_dereference(nf_expect_event_cb);
184 if (notify == NULL) 182 if (notify == NULL)
185 goto out_unlock; 183 goto out_unlock;
186 184
@@ -191,7 +189,7 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
191 if (e->expmask & (1 << event)) { 189 if (e->expmask & (1 << event)) {
192 struct nf_exp_event item = { 190 struct nf_exp_event item = {
193 .exp = exp, 191 .exp = exp,
194 .portid = portid, 192 .pid = pid,
195 .report = report 193 .report = report
196 }; 194 };
197 notify->fcn(1 << event, &item); 195 notify->fcn(1 << event, &item);
@@ -216,20 +214,20 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
216 struct nf_conn *ct) {} 214 struct nf_conn *ct) {}
217static inline int nf_conntrack_eventmask_report(unsigned int eventmask, 215static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
218 struct nf_conn *ct, 216 struct nf_conn *ct,
219 u32 portid, 217 u32 pid,
220 int report) { return 0; } 218 int report) { return 0; }
221static inline int nf_conntrack_event(enum ip_conntrack_events event, 219static inline int nf_conntrack_event(enum ip_conntrack_events event,
222 struct nf_conn *ct) { return 0; } 220 struct nf_conn *ct) { return 0; }
223static inline int nf_conntrack_event_report(enum ip_conntrack_events event, 221static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
224 struct nf_conn *ct, 222 struct nf_conn *ct,
225 u32 portid, 223 u32 pid,
226 int report) { return 0; } 224 int report) { return 0; }
227static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 225static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
228static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 226static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
229 struct nf_conntrack_expect *exp) {} 227 struct nf_conntrack_expect *exp) {}
230static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, 228static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
231 struct nf_conntrack_expect *exp, 229 struct nf_conntrack_expect *exp,
232 u32 portid, 230 u32 pid,
233 int report) {} 231 int report) {}
234 232
235static inline int nf_conntrack_ecache_init(struct net *net) 233static inline int nf_conntrack_ecache_init(struct net *net)