Commit e39e3962 authored by David S. Miller's avatar David S. Miller

Merge bk://kernel.bkbits.net/jmorris/net-2.5

into nuts.ninka.net:/home/davem/src/BK/jmorris-2.5
parents c24564a2 901646db
......@@ -23,6 +23,8 @@
#define SIN6_LEN_RFC2133 24
#define IPV6_MAXPLEN 65535
/*
* NextHeader field of IPv6 header
*/
......
......@@ -432,7 +432,7 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
}
pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2));
if (pkt_len < 0x10000) {
if (pkt_len <= IPV6_MAXPLEN) {
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
return 0;
}
......
......@@ -621,7 +621,7 @@ int ip6_build_xmit(struct sock *sk, inet_getfrag_t getfrag, const void *data,
if (opt)
pktlength += opt->opt_flen + opt->opt_nflen;
if (pktlength > 0xFFFF + sizeof(struct ipv6hdr)) {
if (pktlength > sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
/* Jumbo datagram.
It is assumed, that in the case of hdrincl
jumbo option is supplied by user.
......@@ -1264,8 +1264,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
fragheaderlen = sizeof(struct ipv6hdr) + (opt ? opt->opt_nflen : 0);
maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr);
if (mtu < 65576) {
if (inet->cork.length + length > 0xFFFF - fragheaderlen) {
if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
if (inet->cork.length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) {
ipv6_local_error(sk, EMSGSIZE, fl, mtu-exthdrlen);
return -EMSGSIZE;
}
......@@ -1461,7 +1461,7 @@ int ip6_push_pending_frames(struct sock *sk)
*(u32*)hdr = fl->fl6_flowlabel | htonl(0x60000000);
if (skb->len < 65536)
if (skb->len <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN)
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
else
hdr->payload_len = 0;
......
......@@ -425,7 +425,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
end = offset + (ntohs(skb->nh.ipv6h->payload_len) -
((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
if ((unsigned int)end >= 65536) {
if ((unsigned int)end > IPV6_MAXPLEN) {
icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw);
return;
}
......@@ -597,7 +597,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
/* Unfragmented part is taken from the first segment. */
payload_len = (head->data - head->nh.raw) - sizeof(struct ipv6hdr) + fq->len - sizeof(struct frag_hdr);
if (payload_len > 65535)
if (payload_len > IPV6_MAXPLEN)
goto out_oversize;
/* Head of list must not be cloned. */
......
......@@ -606,13 +606,13 @@ static inline unsigned int ipv6_advmss(unsigned int mtu)
mtu = ip6_rt_min_advmss;
/*
* Maximal non-jumbo IPv6 payload is 65535 and
* corresponding MSS is 65535 - tcp_header_size.
* 65535 is also valid and means: "any MSS,
* Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and
* corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
* IPV6_MAXPLEN is also valid and means: "any MSS,
* rely only on pmtu discovery"
*/
if (mtu > 65535 - sizeof(struct tcphdr))
mtu = 65535;
if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
mtu = IPV6_MAXPLEN;
return mtu;
}
......
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