Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15549
b: refs/heads/master
c: d83d846
h: refs/heads/master
i:
  15547: 1a6c50f
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Jan 3, 2006
1 parent 24e2f9a commit 73a882d
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 84 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22712813620fa8e682dbfb253a60ca0131da1e07
refs/heads/master: d83d8461f902c672bc1bd8fbc6a94e19f092da97
4 changes: 0 additions & 4 deletions trunk/include/linux/dccp.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ struct dccp_ackvec;
* @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
* @dccps_timestamp_time - time of latest TIMESTAMP option
* @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
* @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
* @dccps_pmtu_cookie - Last pmtu seen by socket
* @dccps_packet_size - Set thru setsockopt
* @dccps_role - Role of this sock, one of %dccp_role
* @dccps_ndp_count - number of Non Data Packets since last data packet
Expand All @@ -434,8 +432,6 @@ struct dccp_sock {
__u32 dccps_timestamp_echo;
__u32 dccps_packet_size;
unsigned long dccps_ndp_count;
__u16 dccps_ext_header_len;
__u32 dccps_pmtu_cookie;
__u32 dccps_mss_cache;
struct dccp_options dccps_options;
struct dccp_ackvec *dccps_hc_rx_ackvec;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ struct inet_sock {
__u8 mc_ttl; /* Multicasting TTL */
__u8 pmtudisc;
unsigned recverr : 1,
is_icsk : 1, /* inet_connection_sock? */
freebind : 1,
hdrincl : 1,
mc_loop : 1;
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/linux/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ struct tcp_sock {
__u32 snd_wl1; /* Sequence for window update */
__u32 snd_wnd; /* The window we expect to receive */
__u32 max_window; /* Maximal window ever seen from peer */
__u32 pmtu_cookie; /* Last pmtu seen by socket */
__u32 mss_cache; /* Cached effective mss, not including SACKS */
__u16 xmit_size_goal; /* Goal for segmenting output packets */
__u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
/* XXX Two bytes hole, try to pack */

__u32 window_clamp; /* Maximal window to advertise */
__u32 rcv_ssthresh; /* Current window clamp */
Expand Down
6 changes: 5 additions & 1 deletion trunk/include/net/inet_connection_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct inet_connection_sock_af_ops {
* @icsk_timeout: Timeout
* @icsk_retransmit_timer: Resend (no ack)
* @icsk_rto: Retransmit timeout
* @icsk_pmtu_cookie Last pmtu seen by socket
* @icsk_ca_ops Pluggable congestion control hook
* @icsk_af_ops Operations which are AF_INET{4,6} specific
* @icsk_ca_state: Congestion control state
Expand All @@ -68,6 +69,7 @@ struct inet_connection_sock_af_ops {
* @icsk_backoff: Backoff
* @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
* @icsk_probes_out: unanswered 0 window probes
* @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
* @icsk_ack: Delayed ACK control data
*/
struct inet_connection_sock {
Expand All @@ -79,15 +81,17 @@ struct inet_connection_sock {
struct timer_list icsk_retransmit_timer;
struct timer_list icsk_delack_timer;
__u32 icsk_rto;
__u32 icsk_pmtu_cookie;
struct tcp_congestion_ops *icsk_ca_ops;
struct inet_connection_sock_af_ops *icsk_af_ops;
unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
__u8 icsk_ca_state;
__u8 icsk_retransmits;
__u8 icsk_pending;
__u8 icsk_backoff;
__u8 icsk_syn_retries;
__u8 icsk_probes_out;
/* 2 BYTES HOLE, TRY TO PACK! */
__u16 icsk_ext_hdr_len;
struct {
__u8 pending; /* ACK is pending */
__u8 quick; /* Scheduled number of quick acks */
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct inet_protosw {
};
#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */

extern struct net_protocol *inet_protocol_base;
extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void dccp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_retransmits = icsk->icsk_retransmits;
info->tcpi_probes = icsk->icsk_probes_out;
info->tcpi_backoff = icsk->icsk_backoff;
info->tcpi_pmtu = dp->dccps_pmtu_cookie;
info->tcpi_pmtu = icsk->icsk_pmtu_cookie;

if (dp->dccps_options.dccpo_send_ack_vector)
info->tcpi_options |= TCPI_OPT_SACK;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
goto out_invalid_packet;
}

dccp_sync_mss(sk, dp->dccps_pmtu_cookie);
dccp_sync_mss(sk, icsk->icsk_pmtu_cookie);

/*
* Step 10: Process REQUEST state (second part)
Expand Down
12 changes: 7 additions & 5 deletions trunk/net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
inet->dport = usin->sin_port;
inet->daddr = daddr;

dp->dccps_ext_header_len = 0;
inet_csk(sk)->icsk_ext_hdr_len = 0;
if (inet->opt != NULL)
dp->dccps_ext_header_len = inet->opt->optlen;
inet_csk(sk)->icsk_ext_hdr_len = inet->opt->optlen;
/*
* Socket identity is still unknown (sport may be zero).
* However we set state to DCCP_REQUESTING and not releasing socket
Expand Down Expand Up @@ -191,7 +191,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
mtu = dst_mtu(dst);

if (inet->pmtudisc != IP_PMTUDISC_DONT &&
dp->dccps_pmtu_cookie > mtu) {
inet_csk(sk)->icsk_pmtu_cookie > mtu) {
dccp_sync_mss(sk, mtu);

/*
Expand Down Expand Up @@ -1051,6 +1051,7 @@ struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
int dccp_v4_init_sock(struct sock *sk)
{
struct dccp_sock *dp = dccp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
static int dccp_ctl_socket_init = 1;

dccp_options_init(&dp->dccps_options);
Expand Down Expand Up @@ -1090,10 +1091,11 @@ int dccp_v4_init_sock(struct sock *sk)
dccp_ctl_socket_init = 0;

dccp_init_xmit_timers(sk);
inet_csk(sk)->icsk_rto = DCCP_TIMEOUT_INIT;
icsk->icsk_rto = DCCP_TIMEOUT_INIT;
sk->sk_state = DCCP_CLOSED;
sk->sk_write_space = dccp_write_space;
inet_csk(sk)->icsk_af_ops = &dccp_ipv4_af_ops;
icsk->icsk_af_ops = &dccp_ipv4_af_ops;
icsk->icsk_sync_mss = dccp_sync_mss;
dp->dccps_mss_cache = 536;
dp->dccps_role = DCCP_ROLE_UNDEFINED;
dp->dccps_service = DCCP_SERVICE_INVALID_VALUE;
Expand Down
26 changes: 14 additions & 12 deletions trunk/net/dccp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
int addr_len)
{
struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
struct inet_connection_sock *icsk = inet_csk(sk);
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct dccp_sock *dp = dccp_sk(sk);
Expand Down Expand Up @@ -158,7 +159,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
*/

if (addr_type == IPV6_ADDR_MAPPED) {
u32 exthdrlen = dp->dccps_ext_header_len;
u32 exthdrlen = icsk->icsk_ext_hdr_len;
struct sockaddr_in sin;

SOCK_DEBUG(sk, "connect: ipv4 mapped\n");
Expand All @@ -170,14 +171,14 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
sin.sin_port = usin->sin6_port;
sin.sin_addr.s_addr = usin->sin6_addr.s6_addr32[3];

inet_csk(sk)->icsk_af_ops = &dccp_ipv6_mapped;
icsk->icsk_af_ops = &dccp_ipv6_mapped;
sk->sk_backlog_rcv = dccp_v4_do_rcv;

err = dccp_v4_connect(sk, (struct sockaddr *)&sin, sizeof(sin));

if (err) {
dp->dccps_ext_header_len = exthdrlen;
inet_csk(sk)->icsk_af_ops = &dccp_ipv6_af_ops;
icsk->icsk_ext_hdr_len = exthdrlen;
icsk->icsk_af_ops = &dccp_ipv6_af_ops;
sk->sk_backlog_rcv = dccp_v6_do_rcv;
goto failure;
} else {
Expand Down Expand Up @@ -227,9 +228,10 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,

ip6_dst_store(sk, dst, NULL);

dp->dccps_ext_header_len = 0;
icsk->icsk_ext_hdr_len = 0;
if (np->opt)
dp->dccps_ext_header_len = np->opt->opt_flen + np->opt->opt_nflen;
icsk->icsk_ext_hdr_len = (np->opt->opt_flen +
np->opt->opt_nflen);

inet->dport = usin->sin6_port;

Expand Down Expand Up @@ -292,7 +294,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
np = inet6_sk(sk);

if (type == ICMPV6_PKT_TOOBIG) {
struct dccp_sock *dp = dccp_sk(sk);
struct dst_entry *dst = NULL;

if (sock_owned_by_user(sk))
Expand Down Expand Up @@ -332,7 +333,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} else
dst_hold(dst);

if (dp->dccps_pmtu_cookie > dst_mtu(dst)) {
if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) {
dccp_sync_mss(sk, dst_mtu(dst));
} /* else let the usual retransmit timer handle it */
dst_release(dst);
Expand Down Expand Up @@ -808,7 +809,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
worked with IPv6 icsk.icsk_af_ops.
Sync it now.
*/
dccp_sync_mss(newsk, newdp->dccps_pmtu_cookie);
dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie);

return newsk;
}
Expand Down Expand Up @@ -916,10 +917,10 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
sock_kfree_s(sk, opt, opt->tot_len);
}

newdp->dccps_ext_header_len = 0;
inet_csk(newsk)->icsk_ext_hdr_len = 0;
if (newnp->opt)
newdp->dccps_ext_header_len = newnp->opt->opt_nflen +
newnp->opt->opt_flen;
inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen +
newnp->opt->opt_flen);

dccp_sync_mss(newsk, dst_mtu(dst));

Expand Down Expand Up @@ -1230,6 +1231,7 @@ static struct inet_protosw dccp_v6_protosw = {
.prot = &dccp_v6_prot,
.ops = &inet6_dccp_ops,
.capability = -1,
.flags = INET_PROTOSW_ICSK,
};

static int __init dccp_v6_init(void)
Expand Down
7 changes: 4 additions & 3 deletions trunk/net/dccp/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)

unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu)
{
struct inet_connection_sock *icsk = inet_csk(sk);
struct dccp_sock *dp = dccp_sk(sk);
int mss_now = (pmtu - inet_csk(sk)->icsk_af_ops->net_header_len -
int mss_now = (pmtu - icsk->icsk_af_ops->net_header_len -
sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext));

/* Now subtract optional transport overhead */
mss_now -= dp->dccps_ext_header_len;
mss_now -= icsk->icsk_ext_hdr_len;

/*
* FIXME: this should come from the CCID infrastructure, where, say,
Expand All @@ -152,7 +153,7 @@ unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu)
mss_now -= ((5 + 6 + 10 + 6 + 6 + 6 + 3) / 4) * 4;

/* And store cached results */
dp->dccps_pmtu_cookie = pmtu;
icsk->icsk_pmtu_cookie = pmtu;
dp->dccps_mss_cache = mss_now;

return mss_now;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ static struct inet_protosw dccp_v4_protosw = {
.ops = &inet_dccp_ops,
.capability = -1,
.no_check = 0,
.flags = 0,
.flags = INET_PROTOSW_ICSK,
};

/*
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ static int inet_create(struct socket *sock, int protocol)
sk->sk_reuse = 1;

inet = inet_sk(sk);
inet->is_icsk = INET_PROTOSW_ICSK & answer_flags;

if (SOCK_RAW == sock->type) {
inet->num = protocol;
Expand Down Expand Up @@ -869,7 +870,8 @@ static struct inet_protosw inetsw_array[] =
.ops = &inet_stream_ops,
.capability = -1,
.no_check = 0,
.flags = INET_PROTOSW_PERMANENT,
.flags = INET_PROTOSW_PERMANENT |
INET_PROTOSW_ICSK,
},

{
Expand Down
13 changes: 6 additions & 7 deletions trunk/net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <net/sock.h>
#include <net/ip.h>
#include <net/icmp.h>
#include <net/tcp.h>
#include <linux/tcp.h>
#include <net/tcp_states.h>
#include <linux/udp.h>
#include <linux/igmp.h>
#include <linux/netfilter.h>
Expand Down Expand Up @@ -427,19 +426,19 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
err = ip_options_get_from_user(&opt, optval, optlen);
if (err)
break;
if (sk->sk_type == SOCK_STREAM) {
struct tcp_sock *tp = tcp_sk(sk);
if (inet->is_icsk) {
struct inet_connection_sock *icsk = inet_csk(sk);
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
if (sk->sk_family == PF_INET ||
(!((1 << sk->sk_state) &
(TCPF_LISTEN | TCPF_CLOSE)) &&
inet->daddr != LOOPBACK4_IPV6)) {
#endif
if (inet->opt)
tp->ext_header_len -= inet->opt->optlen;
icsk->icsk_ext_hdr_len -= inet->opt->optlen;
if (opt)
tp->ext_header_len += opt->optlen;
tcp_sync_mss(sk, tp->pmtu_cookie);
icsk->icsk_ext_hdr_len += opt->optlen;
icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_last_data_recv = jiffies_to_msecs(now - icsk->icsk_ack.lrcvtime);
info->tcpi_last_ack_recv = jiffies_to_msecs(now - tp->rcv_tstamp);

info->tcpi_pmtu = tp->pmtu_cookie;
info->tcpi_pmtu = icsk->icsk_pmtu_cookie;
info->tcpi_rcv_ssthresh = tp->rcv_ssthresh;
info->tcpi_rtt = jiffies_to_usecs(tp->srtt)>>3;
info->tcpi_rttvar = jiffies_to_usecs(tp->mdev)>>2;
Expand Down
10 changes: 4 additions & 6 deletions trunk/net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ static int tcp_ack_update_window(struct sock *sk, struct tcp_sock *tp,

if (nwin > tp->max_window) {
tp->max_window = nwin;
tcp_sync_mss(sk, tp->pmtu_cookie);
tcp_sync_mss(sk, inet_csk(sk)->icsk_pmtu_cookie);
}
}
}
Expand Down Expand Up @@ -3967,12 +3967,12 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcphdr *th, unsigned len)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
int saved_clamp = tp->rx_opt.mss_clamp;

tcp_parse_options(skb, &tp->rx_opt, 0);

if (th->ack) {
struct inet_connection_sock *icsk;
/* rfc793:
* "If the state is SYN-SENT then
* first check the ACK bit
Expand Down Expand Up @@ -4061,7 +4061,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
if (tp->rx_opt.sack_ok && sysctl_tcp_fack)
tp->rx_opt.sack_ok |= 2;

tcp_sync_mss(sk, tp->pmtu_cookie);
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
tcp_initialize_rcv_mss(sk);

/* Remember, tcp_poll() does not lock socket!
Expand All @@ -4071,8 +4071,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
mb();
tcp_set_state(sk, TCP_ESTABLISHED);

icsk = inet_csk(sk);

/* Make sure socket is routed, for correct metrics. */
icsk->icsk_af_ops->rebuild_header(sk);

Expand Down Expand Up @@ -4173,7 +4171,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
if (tp->ecn_flags&TCP_ECN_OK)
sock_set_flag(sk, SOCK_NO_LARGESEND);

tcp_sync_mss(sk, tp->pmtu_cookie);
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
tcp_initialize_rcv_mss(sk);


Expand Down
Loading

0 comments on commit 73a882d

Please sign in to comment.