Commit 7174259e authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[TCP_IPV4]: CodingStyle cleanups, no code change

Mostly related to CONFIG_TCP_MD5SIG recent merge.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent 32aac18d
...@@ -93,10 +93,12 @@ static struct socket *tcp_socket; ...@@ -93,10 +93,12 @@ static struct socket *tcp_socket;
void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr); static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
__be32 addr);
static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
__be32 saddr, __be32 daddr, struct tcphdr *th, __be32 saddr, __be32 daddr,
int protocol, int tcplen); struct tcphdr *th, int protocol,
int tcplen);
#endif #endif
struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
...@@ -215,13 +217,14 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -215,13 +217,14 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
if (tcp_death_row.sysctl_tw_recycle && if (tcp_death_row.sysctl_tw_recycle &&
!tp->rx_opt.ts_recent_stamp && rt->rt_dst == daddr) { !tp->rx_opt.ts_recent_stamp && rt->rt_dst == daddr) {
struct inet_peer *peer = rt_get_peer(rt); struct inet_peer *peer = rt_get_peer(rt);
/*
/* VJ's idea. We save last timestamp seen from * VJ's idea. We save last timestamp seen from
* the destination in peer table, when entering state TIME-WAIT * the destination in peer table, when entering state
* and initialize rx_opt.ts_recent from it, when trying new connection. * TIME-WAIT * and initialize rx_opt.ts_recent from it,
* when trying new connection.
*/ */
if (peer != NULL &&
if (peer && peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtime.tv_sec) { peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtime.tv_sec) {
tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp; tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp;
tp->rx_opt.ts_recent = peer->tcp_ts; tp->rx_opt.ts_recent = peer->tcp_ts;
} }
...@@ -246,7 +249,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -246,7 +249,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
if (err) if (err)
goto failure; goto failure;
err = ip_route_newports(&rt, IPPROTO_TCP, inet->sport, inet->dport, sk); err = ip_route_newports(&rt, IPPROTO_TCP,
inet->sport, inet->dport, sk);
if (err) if (err)
goto failure; goto failure;
...@@ -270,7 +274,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -270,7 +274,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return 0; return 0;
failure: failure:
/* This unhashes the socket and releases the local port, if necessary. */ /*
* This unhashes the socket and releases the local port,
* if necessary.
*/
tcp_set_state(sk, TCP_CLOSE); tcp_set_state(sk, TCP_CLOSE);
ip_rt_put(rt); ip_rt_put(rt);
sk->sk_route_caps = 0; sk->sk_route_caps = 0;
...@@ -495,7 +502,8 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) ...@@ -495,7 +502,8 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb)
struct tcphdr *th = skb->h.th; struct tcphdr *th = skb->h.th;
if (skb->ip_summed == CHECKSUM_PARTIAL) { if (skb->ip_summed == CHECKSUM_PARTIAL) {
th->check = ~tcp_v4_check(th, len, inet->saddr, inet->daddr, 0); th->check = ~tcp_v4_check(th, len,
inet->saddr, inet->daddr, 0);
skb->csum = offsetof(struct tcphdr, check); skb->csum = offsetof(struct tcphdr, check);
} else { } else {
th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr, th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr,
...@@ -572,7 +580,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) ...@@ -572,7 +580,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
skb->len - (th->doff << 2)); skb->len - (th->doff << 2));
} }
memset(&arg, 0, sizeof arg); memset(&arg, 0, sizeof(arg));
arg.iov[0].iov_base = (unsigned char *)&rep; arg.iov[0].iov_base = (unsigned char *)&rep;
arg.iov[0].iov_len = sizeof(rep.th); arg.iov[0].iov_len = sizeof(rep.th);
...@@ -595,9 +603,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) ...@@ -595,9 +603,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
arg.iov[0].iov_len); arg.iov[0].iov_len);
} }
#endif #endif
arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr, arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr,
skb->nh.iph->saddr, /*XXX*/ skb->nh.iph->saddr, /* XXX */
sizeof(struct tcphdr), IPPROTO_TCP, 0); sizeof(struct tcphdr), IPPROTO_TCP, 0);
arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.csumoffset = offsetof(struct tcphdr, check) / 2;
...@@ -631,7 +638,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, ...@@ -631,7 +638,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
#endif #endif
memset(&rep.th, 0, sizeof(struct tcphdr)); memset(&rep.th, 0, sizeof(struct tcphdr));
memset(&arg, 0, sizeof arg); memset(&arg, 0, sizeof(arg));
arg.iov[0].iov_base = (unsigned char *)&rep; arg.iov[0].iov_base = (unsigned char *)&rep;
arg.iov[0].iov_len = sizeof(rep.th); arg.iov[0].iov_len = sizeof(rep.th);
...@@ -668,9 +675,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, ...@@ -668,9 +675,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
tw_key.key = twsk->tw_md5_key; tw_key.key = twsk->tw_md5_key;
tw_key.keylen = twsk->tw_md5_keylen; tw_key.keylen = twsk->tw_md5_keylen;
key = &tw_key; key = &tw_key;
} else { } else
key = NULL; key = NULL;
}
if (key) { if (key) {
int offset = (ts) ? 3 : 0; int offset = (ts) ? 3 : 0;
...@@ -690,9 +696,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, ...@@ -690,9 +696,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
arg.iov[0].iov_len); arg.iov[0].iov_len);
} }
#endif #endif
arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr, arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr,
skb->nh.iph->saddr, /*XXX*/ skb->nh.iph->saddr, /* XXX */
arg.iov[0].iov_len, IPPROTO_TCP, 0); arg.iov[0].iov_len, IPPROTO_TCP, 0);
arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.csumoffset = offsetof(struct tcphdr, check) / 2;
...@@ -707,12 +712,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) ...@@ -707,12 +712,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
struct tcp_timewait_sock *tcptw = tcp_twsk(sk); struct tcp_timewait_sock *tcptw = tcp_twsk(sk);
tcp_v4_send_ack(tcptw, skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, tcp_v4_send_ack(tcptw, skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt,
tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, tcptw->tw_ts_recent); tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
tcptw->tw_ts_recent);
inet_twsk_put(tw); inet_twsk_put(tw);
} }
static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) static void tcp_v4_reqsk_send_ack(struct sk_buff *skb,
struct request_sock *req)
{ {
tcp_v4_send_ack(NULL, skb, tcp_rsk(req)->snt_isn + 1, tcp_v4_send_ack(NULL, skb, tcp_rsk(req)->snt_isn + 1,
tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd,
...@@ -809,7 +816,8 @@ static struct ip_options *tcp_v4_save_options(struct sock *sk, ...@@ -809,7 +816,8 @@ static struct ip_options *tcp_v4_save_options(struct sock *sk,
*/ */
/* Find the Key structure for an address. */ /* Find the Key structure for an address. */
static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) static struct tcp_md5sig_key *
tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
int i; int i;
...@@ -818,7 +826,8 @@ static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) ...@@ -818,7 +826,8 @@ static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr)
return NULL; return NULL;
for (i = 0; i < tp->md5sig_info->entries4; i++) { for (i = 0; i < tp->md5sig_info->entries4; i++) {
if (tp->md5sig_info->keys4[i].addr == addr) if (tp->md5sig_info->keys4[i].addr == addr)
return (struct tcp_md5sig_key *)&tp->md5sig_info->keys4[i]; return (struct tcp_md5sig_key *)
&tp->md5sig_info->keys4[i];
} }
return NULL; return NULL;
} }
...@@ -915,13 +924,12 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr) ...@@ -915,13 +924,12 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
if (tp->md5sig_info->entries4 == 0) { if (tp->md5sig_info->entries4 == 0) {
kfree(tp->md5sig_info->keys4); kfree(tp->md5sig_info->keys4);
tp->md5sig_info->keys4 = NULL; tp->md5sig_info->keys4 = NULL;
} else { } else if (tp->md5sig_info->entries4 != i) {
/* Need to do some manipulation */ /* Need to do some manipulation */
if (tp->md5sig_info->entries4 != i)
memcpy(&tp->md5sig_info->keys4[i], memcpy(&tp->md5sig_info->keys4[i],
&tp->md5sig_info->keys4[i+1], &tp->md5sig_info->keys4[i+1],
(tp->md5sig_info->entries4 - i) (tp->md5sig_info->entries4 - i) *
* sizeof (struct tcp4_md5sig_key)); sizeof(struct tcp4_md5sig_key));
} }
tcp_free_md5sig_pool(); tcp_free_md5sig_pool();
return 0; return 0;
...@@ -932,7 +940,7 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr) ...@@ -932,7 +940,7 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
EXPORT_SYMBOL(tcp_v4_md5_do_del); EXPORT_SYMBOL(tcp_v4_md5_do_del);
static void tcp_v4_clear_md5_list (struct sock *sk) static void tcp_v4_clear_md5_list(struct sock *sk)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
...@@ -954,7 +962,7 @@ static void tcp_v4_clear_md5_list (struct sock *sk) ...@@ -954,7 +962,7 @@ static void tcp_v4_clear_md5_list (struct sock *sk)
} }
} }
static int tcp_v4_parse_md5_keys (struct sock *sk, char __user *optval, static int tcp_v4_parse_md5_keys(struct sock *sk, char __user *optval,
int optlen) int optlen)
{ {
struct tcp_md5sig cmd; struct tcp_md5sig cmd;
...@@ -964,7 +972,7 @@ static int tcp_v4_parse_md5_keys (struct sock *sk, char __user *optval, ...@@ -964,7 +972,7 @@ static int tcp_v4_parse_md5_keys (struct sock *sk, char __user *optval,
if (optlen < sizeof(cmd)) if (optlen < sizeof(cmd))
return -EINVAL; return -EINVAL;
if (copy_from_user (&cmd, optval, sizeof(cmd))) if (copy_from_user(&cmd, optval, sizeof(cmd)))
return -EFAULT; return -EFAULT;
if (sin->sin_family != AF_INET) if (sin->sin_family != AF_INET)
...@@ -981,9 +989,8 @@ static int tcp_v4_parse_md5_keys (struct sock *sk, char __user *optval, ...@@ -981,9 +989,8 @@ static int tcp_v4_parse_md5_keys (struct sock *sk, char __user *optval,
if (!tcp_sk(sk)->md5sig_info) { if (!tcp_sk(sk)->md5sig_info) {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct tcp_md5sig_info *p; struct tcp_md5sig_info *p = kzalloc(sizeof(*p), GFP_KERNEL);
p = kzalloc(sizeof(struct tcp_md5sig_info), GFP_KERNEL);
if (!p) if (!p)
return -EINVAL; return -EINVAL;
...@@ -1044,8 +1051,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1044,8 +1051,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
#ifdef CONFIG_TCP_MD5SIG_DEBUG #ifdef CONFIG_TCP_MD5SIG_DEBUG
printk("Calcuating hash for: "); printk("Calcuating hash for: ");
for (i = 0; i < sizeof (*bp); i++) for (i = 0; i < sizeof(*bp); i++)
printk ("%02x ", (unsigned int)((unsigned char *)bp)[i]); printk("%02x ", (unsigned int)((unsigned char *)bp)[i]);
printk(" "); printk(" ");
#endif #endif
...@@ -1057,8 +1064,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1057,8 +1064,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
sg_set_buf(&sg[block++], th, sizeof(struct tcphdr)); sg_set_buf(&sg[block++], th, sizeof(struct tcphdr));
nbytes += sizeof(struct tcphdr); nbytes += sizeof(struct tcphdr);
#ifdef CONFIG_TCP_MD5SIG_DEBUG #ifdef CONFIG_TCP_MD5SIG_DEBUG
for (i = 0; i < sizeof (struct tcphdr); i++) for (i = 0; i < sizeof(struct tcphdr); i++)
printk (" %02x", (unsigned int)((unsigned char *)th)[i]); printk(" %02x", (unsigned int)((unsigned char *)th)[i]);
#endif #endif
/* 3. the TCP segment data (if any) */ /* 3. the TCP segment data (if any) */
data_len = tcplen - (th->doff << 2); data_len = tcplen - (th->doff << 2);
...@@ -1075,9 +1082,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1075,9 +1082,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
nbytes += key->keylen; nbytes += key->keylen;
#ifdef CONFIG_TCP_MD5SIG_DEBUG #ifdef CONFIG_TCP_MD5SIG_DEBUG
printk (" and password: "); printk(" and password: ");
for (i = 0; i < key->keylen; i++) for (i = 0; i < key->keylen; i++)
printk ("%02x ", (unsigned int)key->key[i]); printk("%02x ", (unsigned int)key->key[i]);
#endif #endif
/* Now store the Hash into the packet */ /* Now store the Hash into the packet */
...@@ -1099,7 +1106,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1099,7 +1106,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
#ifdef CONFIG_TCP_MD5SIG_DEBUG #ifdef CONFIG_TCP_MD5SIG_DEBUG
printk(" result:"); printk(" result:");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
printk (" %02x", (unsigned int)(((u8*)md5_hash)[i])); printk(" %02x", (unsigned int)(((u8*)md5_hash)[i]));
printk("\n"); printk("\n");
#endif #endif
return 0; return 0;
...@@ -1135,7 +1142,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1135,7 +1142,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
EXPORT_SYMBOL(tcp_v4_calc_md5_hash); EXPORT_SYMBOL(tcp_v4_calc_md5_hash);
static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb)
{ {
/* /*
* This gets called for each TCP segment that arrives * This gets called for each TCP segment that arrives
...@@ -1149,7 +1156,7 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) ...@@ -1149,7 +1156,7 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
struct tcp_md5sig_key *hash_expected; struct tcp_md5sig_key *hash_expected;
struct iphdr *iph = skb->nh.iph; struct iphdr *iph = skb->nh.iph;
struct tcphdr *th = skb->h.th; struct tcphdr *th = skb->h.th;
int length = (th->doff << 2) - sizeof (struct tcphdr); int length = (th->doff << 2) - sizeof(struct tcphdr);
int genhash; int genhash;
unsigned char *ptr; unsigned char *ptr;
unsigned char newhash[16]; unsigned char newhash[16];
...@@ -1200,22 +1207,18 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) ...@@ -1200,22 +1207,18 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
return 0; return 0;
if (hash_expected && !hash_location) { if (hash_expected && !hash_location) {
if (net_ratelimit()) { LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found "
printk(KERN_INFO "MD5 Hash NOT expected but found "
"(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n", "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
NIPQUAD (iph->saddr), ntohs(th->source), NIPQUAD(iph->saddr), ntohs(th->source),
NIPQUAD (iph->daddr), ntohs(th->dest)); NIPQUAD(iph->daddr), ntohs(th->dest));
}
return 1; return 1;
} }
if (!hash_expected && hash_location) { if (!hash_expected && hash_location) {
if (net_ratelimit()) { LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found "
printk(KERN_INFO "MD5 Hash NOT expected but found "
"(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n", "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
NIPQUAD (iph->saddr), ntohs(th->source), NIPQUAD(iph->saddr), ntohs(th->source),
NIPQUAD (iph->daddr), ntohs(th->dest)); NIPQUAD(iph->daddr), ntohs(th->dest));
}
return 1; return 1;
} }
...@@ -1232,15 +1235,16 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) ...@@ -1232,15 +1235,16 @@ static int tcp_v4_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_INFO "MD5 Hash failed for " printk(KERN_INFO "MD5 Hash failed for "
"(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)%s\n", "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)%s\n",
NIPQUAD (iph->saddr), ntohs(th->source), NIPQUAD(iph->saddr), ntohs(th->source),
NIPQUAD (iph->daddr), ntohs(th->dest), NIPQUAD(iph->daddr), ntohs(th->dest),
genhash ? " tcp_v4_calc_md5_hash failed" : ""); genhash ? " tcp_v4_calc_md5_hash failed" : "");
#ifdef CONFIG_TCP_MD5SIG_DEBUG #ifdef CONFIG_TCP_MD5SIG_DEBUG
do { do {
int i; int i;
printk("Received: "); printk("Received: ");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
printk("%02x ", 0xff & (int)hash_location[i]); printk("%02x ",
0xff & (int)hash_location[i]);
printk("\n"); printk("\n");
printk("Calculated: "); printk("Calculated: ");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
...@@ -1582,7 +1586,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -1582,7 +1586,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
* o We're expecting an MD5'd packet and this is no MD5 tcp option * o We're expecting an MD5'd packet and this is no MD5 tcp option
* o There is an MD5 option and we're not expecting one * o There is an MD5 option and we're not expecting one
*/ */
if (tcp_v4_inbound_md5_hash (sk, skb)) if (tcp_v4_inbound_md5_hash(sk, skb))
goto discard; goto discard;
#endif #endif
...@@ -2356,7 +2360,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i) ...@@ -2356,7 +2360,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i)
"%08X %5d %8d %lu %d %p %u %u %u %u %d", "%08X %5d %8d %lu %d %p %u %u %u %u %d",
i, src, srcp, dest, destp, sp->sk_state, i, src, srcp, dest, destp, sp->sk_state,
tp->write_seq - tp->snd_una, tp->write_seq - tp->snd_una,
(sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), sp->sk_state == TCP_LISTEN ? sp->sk_ack_backlog :
(tp->rcv_nxt - tp->copied_seq),
timer_active, timer_active,
jiffies_to_clock_t(timer_expires - jiffies), jiffies_to_clock_t(timer_expires - jiffies),
icsk->icsk_retransmits, icsk->icsk_retransmits,
...@@ -2371,7 +2376,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i) ...@@ -2371,7 +2376,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i)
tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh); tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh);
} }
static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i) static void get_timewait4_sock(struct inet_timewait_sock *tw,
char *tmpbuf, int i)
{ {
__be32 dest, src; __be32 dest, src;
__u16 destp, srcp; __u16 destp, srcp;
...@@ -2484,7 +2490,8 @@ struct proto tcp_prot = { ...@@ -2484,7 +2490,8 @@ struct proto tcp_prot = {
void __init tcp_v4_init(struct net_proto_family *ops) void __init tcp_v4_init(struct net_proto_family *ops)
{ {
if (inet_csk_ctl_sock_create(&tcp_socket, PF_INET, SOCK_RAW, IPPROTO_TCP) < 0) if (inet_csk_ctl_sock_create(&tcp_socket, PF_INET, SOCK_RAW,
IPPROTO_TCP) < 0)
panic("Failed to create the TCP control socket.\n"); panic("Failed to create the TCP control socket.\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment