@@ -26,6 +26,11 @@ struct nf_conntrack_expect {
void (*expectfn)(struct nf_conn *new,
struct nf_conntrack_expect *this);
+#ifdef ATL_CHANGE
+ /* Logging function to call when seeing an expected connection */
+ void (*logfn)(const struct nf_conntrack_tuple *tuple);
+#endif
+
/* Helper to assign to new connection */
struct nf_conntrack_helper *helper;
@@ -984,6 +984,10 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
if (help)
rcu_assign_pointer(help->helper, exp->helper);
}
+#ifdef ATL_CHANGE
+ if (exp->logfn)
+ exp->logfn(tuple);
+#endif
#ifdef CONFIG_NF_CONNTRACK_MARK
ct->mark = exp->master->mark;
@@ -382,6 +382,23 @@ static void update_nl_seq(struct nf_conn *ct, u32 nl_seq,
}
}
+#ifdef ATL_CHANGE
+void log_ftp_data_connection(const struct nf_conntrack_tuple *tuple)
+{
+ if (tuple) {
+ if (tuple->src.l3num == PF_INET) {
+ pr_info("FTP data connection initiated by %pI4:%d to %pI4:%d\n",
+ &tuple->src.u3.ip, tuple->src.u.tcp.port,
+ &tuple->dst.u3.ip, tuple->dst.u.tcp.port);
+ } else {
+ pr_info("FTP data connection initiated by %pI6:%d to %pI6:%d\n",
+ &tuple->src.u3.ip, tuple->src.u.tcp.port,
+ &tuple->dst.u3.ip, tuple->dst.u.tcp.port);
+ }
+ }
+}
+#endif
+
static int help(struct sk_buff *skb,
unsigned int protoff,
struct nf_conn *ct,
@@ -529,6 +546,10 @@ skip_nl_seq:
&ct->tuplehash[!dir].tuple.src.u3, daddr,
IPPROTO_TCP, NULL, &cmd.u.tcp.port);
+#ifdef ATL_CHANGE
+ exp->logfn = log_ftp_data_connection;
+#endif
+
/* Now, NAT might want to mangle the packet, and register the
* (possibly changed) expectation itself. */
nf_nat_ftp = rcu_dereference(nf_nat_ftp_hook);