|
@@ -257,9 +257,8 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-static int tcp_pkt_to_tuple(const struct sk_buff *skb,
|
|
|
- unsigned int dataoff,
|
|
|
- struct nf_conntrack_tuple *tuple)
|
|
|
+static bool tcp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
|
|
|
+ struct nf_conntrack_tuple *tuple)
|
|
|
{
|
|
|
const struct tcphdr *hp;
|
|
|
struct tcphdr _hdr;
|
|
@@ -267,20 +266,20 @@ static int tcp_pkt_to_tuple(const struct sk_buff *skb,
|
|
|
/* Actually only need first 8 bytes. */
|
|
|
hp = skb_header_pointer(skb, dataoff, 8, &_hdr);
|
|
|
if (hp == NULL)
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
tuple->src.u.tcp.port = hp->source;
|
|
|
tuple->dst.u.tcp.port = hp->dest;
|
|
|
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
-static int tcp_invert_tuple(struct nf_conntrack_tuple *tuple,
|
|
|
- const struct nf_conntrack_tuple *orig)
|
|
|
+static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple,
|
|
|
+ const struct nf_conntrack_tuple *orig)
|
|
|
{
|
|
|
tuple->src.u.tcp.port = orig->dst.u.tcp.port;
|
|
|
tuple->dst.u.tcp.port = orig->src.u.tcp.port;
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/* Print out the per-protocol part of the tuple. */
|
|
@@ -478,20 +477,20 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int tcp_in_window(const struct nf_conn *ct,
|
|
|
- struct ip_ct_tcp *state,
|
|
|
- enum ip_conntrack_dir dir,
|
|
|
- unsigned int index,
|
|
|
- const struct sk_buff *skb,
|
|
|
- unsigned int dataoff,
|
|
|
- const struct tcphdr *tcph,
|
|
|
- int pf)
|
|
|
+static bool tcp_in_window(const struct nf_conn *ct,
|
|
|
+ struct ip_ct_tcp *state,
|
|
|
+ enum ip_conntrack_dir dir,
|
|
|
+ unsigned int index,
|
|
|
+ const struct sk_buff *skb,
|
|
|
+ unsigned int dataoff,
|
|
|
+ const struct tcphdr *tcph,
|
|
|
+ int pf)
|
|
|
{
|
|
|
struct ip_ct_tcp_state *sender = &state->seen[dir];
|
|
|
struct ip_ct_tcp_state *receiver = &state->seen[!dir];
|
|
|
const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
|
|
|
__u32 seq, ack, sack, end, win, swin;
|
|
|
- int res;
|
|
|
+ bool res;
|
|
|
|
|
|
/*
|
|
|
* Get the required data from the packet.
|
|
@@ -657,12 +656,12 @@ static int tcp_in_window(const struct nf_conn *ct,
|
|
|
state->retrans = 0;
|
|
|
}
|
|
|
}
|
|
|
- res = 1;
|
|
|
+ res = true;
|
|
|
} else {
|
|
|
- res = 0;
|
|
|
+ res = false;
|
|
|
if (sender->flags & IP_CT_TCP_FLAG_BE_LIBERAL ||
|
|
|
nf_ct_tcp_be_liberal)
|
|
|
- res = 1;
|
|
|
+ res = true;
|
|
|
if (!res && LOG_INVALID(IPPROTO_TCP))
|
|
|
nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
|
|
|
"nf_ct_tcp: %s ",
|
|
@@ -676,7 +675,7 @@ static int tcp_in_window(const struct nf_conn *ct,
|
|
|
: "SEQ is over the upper bound (over the window of the receiver)");
|
|
|
}
|
|
|
|
|
|
- pr_debug("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u "
|
|
|
+ pr_debug("tcp_in_window: res=%u sender end=%u maxend=%u maxwin=%u "
|
|
|
"receiver end=%u maxend=%u maxwin=%u\n",
|
|
|
res, sender->td_end, sender->td_maxend, sender->td_maxwin,
|
|
|
receiver->td_end, receiver->td_maxend, receiver->td_maxwin);
|
|
@@ -982,9 +981,8 @@ static int tcp_packet(struct nf_conn *ct,
|
|
|
}
|
|
|
|
|
|
/* Called when a new connection for this protocol found. */
|
|
|
-static int tcp_new(struct nf_conn *ct,
|
|
|
- const struct sk_buff *skb,
|
|
|
- unsigned int dataoff)
|
|
|
+static bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,
|
|
|
+ unsigned int dataoff)
|
|
|
{
|
|
|
enum tcp_conntrack new_state;
|
|
|
const struct tcphdr *th;
|
|
@@ -1003,7 +1001,7 @@ static int tcp_new(struct nf_conn *ct,
|
|
|
/* Invalid: delete conntrack */
|
|
|
if (new_state >= TCP_CONNTRACK_MAX) {
|
|
|
pr_debug("nf_ct_tcp: invalid new deleting.\n");
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
if (new_state == TCP_CONNTRACK_SYN_SENT) {
|
|
@@ -1021,7 +1019,7 @@ static int tcp_new(struct nf_conn *ct,
|
|
|
ct->proto.tcp.seen[1].flags = 0;
|
|
|
} else if (nf_ct_tcp_loose == 0) {
|
|
|
/* Don't try to pick up connections. */
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
} else {
|
|
|
/*
|
|
|
* We are in the middle of a connection,
|
|
@@ -1061,7 +1059,7 @@ static int tcp_new(struct nf_conn *ct,
|
|
|
sender->td_scale,
|
|
|
receiver->td_end, receiver->td_maxend, receiver->td_maxwin,
|
|
|
receiver->td_scale);
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|