aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-05-16 19:15:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-17 14:59:59 -0400
commita2a385d627e1549da4b43a8b3dfe370589766e1c (patch)
treed61e9913497c6c14406032f6a0822738707f1abf /net/ipv4/tcp_ipv4.c
parente005d193d55ee5f757b13306112d8c23aac27a88 (diff)
tcp: bool conversions
bool conversions where possible. __inline__ -> inline space cleanups Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 2e76ffb66d7c..a43b87dfe800 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -866,14 +866,14 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req)
866} 866}
867 867
868/* 868/*
869 * Return 1 if a syncookie should be sent 869 * Return true if a syncookie should be sent
870 */ 870 */
871int tcp_syn_flood_action(struct sock *sk, 871bool tcp_syn_flood_action(struct sock *sk,
872 const struct sk_buff *skb, 872 const struct sk_buff *skb,
873 const char *proto) 873 const char *proto)
874{ 874{
875 const char *msg = "Dropping request"; 875 const char *msg = "Dropping request";
876 int want_cookie = 0; 876 bool want_cookie = false;
877 struct listen_sock *lopt; 877 struct listen_sock *lopt;
878 878
879 879
@@ -881,7 +881,7 @@ int tcp_syn_flood_action(struct sock *sk,
881#ifdef CONFIG_SYN_COOKIES 881#ifdef CONFIG_SYN_COOKIES
882 if (sysctl_tcp_syncookies) { 882 if (sysctl_tcp_syncookies) {
883 msg = "Sending cookies"; 883 msg = "Sending cookies";
884 want_cookie = 1; 884 want_cookie = true;
885 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES); 885 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES);
886 } else 886 } else
887#endif 887#endif
@@ -1196,7 +1196,7 @@ clear_hash_noput:
1196} 1196}
1197EXPORT_SYMBOL(tcp_v4_md5_hash_skb); 1197EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
1198 1198
1199static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) 1199static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
1200{ 1200{
1201 /* 1201 /*
1202 * This gets called for each TCP segment that arrives 1202 * This gets called for each TCP segment that arrives
@@ -1219,16 +1219,16 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
1219 1219
1220 /* We've parsed the options - do we have a hash? */ 1220 /* We've parsed the options - do we have a hash? */
1221 if (!hash_expected && !hash_location) 1221 if (!hash_expected && !hash_location)
1222 return 0; 1222 return false;
1223 1223
1224 if (hash_expected && !hash_location) { 1224 if (hash_expected && !hash_location) {
1225 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND); 1225 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
1226 return 1; 1226 return true;
1227 } 1227 }
1228 1228
1229 if (!hash_expected && hash_location) { 1229 if (!hash_expected && hash_location) {
1230 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED); 1230 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
1231 return 1; 1231 return true;
1232 } 1232 }
1233 1233
1234 /* Okay, so this is hash_expected and hash_location - 1234 /* Okay, so this is hash_expected and hash_location -
@@ -1244,9 +1244,9 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
1244 &iph->daddr, ntohs(th->dest), 1244 &iph->daddr, ntohs(th->dest),
1245 genhash ? " tcp_v4_calc_md5_hash failed" 1245 genhash ? " tcp_v4_calc_md5_hash failed"
1246 : ""); 1246 : "");
1247 return 1; 1247 return true;
1248 } 1248 }
1249 return 0; 1249 return false;
1250} 1250}
1251 1251
1252#endif 1252#endif
@@ -1280,7 +1280,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1280 __be32 saddr = ip_hdr(skb)->saddr; 1280 __be32 saddr = ip_hdr(skb)->saddr;
1281 __be32 daddr = ip_hdr(skb)->daddr; 1281 __be32 daddr = ip_hdr(skb)->daddr;
1282 __u32 isn = TCP_SKB_CB(skb)->when; 1282 __u32 isn = TCP_SKB_CB(skb)->when;
1283 int want_cookie = 0; 1283 bool want_cookie = false;
1284 1284
1285 /* Never answer to SYNs send to broadcast or multicast */ 1285 /* Never answer to SYNs send to broadcast or multicast */
1286 if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) 1286 if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
@@ -1339,7 +1339,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1339 while (l-- > 0) 1339 while (l-- > 0)
1340 *c++ ^= *hash_location++; 1340 *c++ ^= *hash_location++;
1341 1341
1342 want_cookie = 0; /* not our kind of cookie */ 1342 want_cookie = false; /* not our kind of cookie */
1343 tmp_ext.cookie_out_never = 0; /* false */ 1343 tmp_ext.cookie_out_never = 0; /* false */
1344 tmp_ext.cookie_plus = tmp_opt.cookie_plus; 1344 tmp_ext.cookie_plus = tmp_opt.cookie_plus;
1345 } else if (!tp->rx_opt.cookie_in_always) { 1345 } else if (!tp->rx_opt.cookie_in_always) {
@@ -2073,7 +2073,7 @@ static void *listening_get_idx(struct seq_file *seq, loff_t *pos)
2073 return rc; 2073 return rc;
2074} 2074}
2075 2075
2076static inline int empty_bucket(struct tcp_iter_state *st) 2076static inline bool empty_bucket(struct tcp_iter_state *st)
2077{ 2077{
2078 return hlist_nulls_empty(&tcp_hashinfo.ehash[st->bucket].chain) && 2078 return hlist_nulls_empty(&tcp_hashinfo.ehash[st->bucket].chain) &&
2079 hlist_nulls_empty(&tcp_hashinfo.ehash[st->bucket].twchain); 2079 hlist_nulls_empty(&tcp_hashinfo.ehash[st->bucket].twchain);