misc/ss: tcp cwnd should be unsigned
tcp->snd_cwd is a u32, but ss treats it like a signed int. This may results in negative bandwidth calculations. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Acked-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
ec75249b14
commit
d1f338b318
|
|
@ -755,11 +755,12 @@ struct tcpstat {
|
||||||
int probes;
|
int probes;
|
||||||
char cong_alg[16];
|
char cong_alg[16];
|
||||||
double rto, ato, rtt, rttvar;
|
double rto, ato, rtt, rttvar;
|
||||||
int qack, cwnd, ssthresh, backoff;
|
int qack, ssthresh, backoff;
|
||||||
double send_bps;
|
double send_bps;
|
||||||
int snd_wscale;
|
int snd_wscale;
|
||||||
int rcv_wscale;
|
int rcv_wscale;
|
||||||
int mss;
|
int mss;
|
||||||
|
unsigned int cwnd;
|
||||||
unsigned int lastsnd;
|
unsigned int lastsnd;
|
||||||
unsigned int lastrcv;
|
unsigned int lastrcv;
|
||||||
unsigned int lastack;
|
unsigned int lastack;
|
||||||
|
|
@ -1805,7 +1806,7 @@ static void tcp_stats_print(struct tcpstat *s)
|
||||||
if (s->mss)
|
if (s->mss)
|
||||||
printf(" mss:%d", s->mss);
|
printf(" mss:%d", s->mss);
|
||||||
if (s->cwnd)
|
if (s->cwnd)
|
||||||
printf(" cwnd:%d", s->cwnd);
|
printf(" cwnd:%u", s->cwnd);
|
||||||
if (s->ssthresh)
|
if (s->ssthresh)
|
||||||
printf(" ssthresh:%d", s->ssthresh);
|
printf(" ssthresh:%d", s->ssthresh);
|
||||||
|
|
||||||
|
|
@ -1924,7 +1925,7 @@ static int tcp_show_line(char *line, const struct filter *f, int family)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
opt[0] = 0;
|
opt[0] = 0;
|
||||||
n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %d %d %[^\n]\n",
|
n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %u %d %[^\n]\n",
|
||||||
&s.ss.state, &s.ss.wq, &s.ss.rq,
|
&s.ss.state, &s.ss.wq, &s.ss.rq,
|
||||||
&s.timer, &s.timeout, &s.retrans, &s.ss.uid, &s.probes,
|
&s.timer, &s.timeout, &s.retrans, &s.ss.uid, &s.probes,
|
||||||
&s.ss.ino, &s.ss.refcnt, &s.ss.sk, &rto, &ato, &s.qack, &s.cwnd,
|
&s.ss.ino, &s.ss.refcnt, &s.ss.sk, &rto, &ato, &s.qack, &s.cwnd,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue