提交 269bd27e 编写于 作者: A Al Viro 提交者: David S. Miller

[TCP]: struct tcp_sack_block annotations

Some of the instances of tcp_sack_block are host-endian, some - net-endian.
Define struct tcp_sack_block_wire identical to struct tcp_sack_block
with u32 replaced with __be32; annotate uses of tcp_sack_block replacing
net-endian ones with tcp_sack_block_wire.  Change is obviously safe since
for cc(1) __be32 is typedefed to u32.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 46a97324
...@@ -166,6 +166,11 @@ struct tcp_info ...@@ -166,6 +166,11 @@ struct tcp_info
#include <net/inet_timewait_sock.h> #include <net/inet_timewait_sock.h>
/* This defines a selective acknowledgement block. */ /* This defines a selective acknowledgement block. */
struct tcp_sack_block_wire {
__be32 start_seq;
__be32 end_seq;
};
struct tcp_sack_block { struct tcp_sack_block {
__u32 start_seq; __u32 start_seq;
__u32 end_seq; __u32 end_seq;
......
...@@ -283,7 +283,7 @@ sack_adjust(struct sk_buff *skb, ...@@ -283,7 +283,7 @@ sack_adjust(struct sk_buff *skb,
struct ip_nat_seq *natseq) struct ip_nat_seq *natseq)
{ {
while (sackoff < sackend) { while (sackoff < sackend) {
struct tcp_sack_block *sack; struct tcp_sack_block_wire *sack;
u_int32_t new_start_seq, new_end_seq; u_int32_t new_start_seq, new_end_seq;
sack = (void *)skb->data + sackoff; sack = (void *)skb->data + sackoff;
......
...@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ ...@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
const struct inet_connection_sock *icsk = inet_csk(sk); const struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked;
struct tcp_sack_block *sp = (struct tcp_sack_block *)(ptr+2); struct tcp_sack_block_wire *sp = (struct tcp_sack_block_wire *)(ptr+2);
int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3;
int reord = tp->packets_out; int reord = tp->packets_out;
int prior_fackets; int prior_fackets;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册