projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'spi-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[firefly-linux-kernel-4.4.55.git]
/
net
/
ipv4
/
ip_options.c
diff --git
a/net/ipv4/ip_options.c
b/net/ipv4/ip_options.c
index 310a3647c83d948949e8c76ef8e89b68def338dd..f4ab72e19af923536656e734996f4b9201684b58 100644
(file)
--- a/
net/ipv4/ip_options.c
+++ b/
net/ipv4/ip_options.c
@@
-167,7
+167,7
@@
int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
soffset -= 4;
if (soffset > 3) {
memcpy(&faddr, &start[soffset-1], 4);
soffset -= 4;
if (soffset > 3) {
memcpy(&faddr, &start[soffset-1], 4);
- for (soffset
-=4, doffset=4; soffset > 3; soffset-=4, doffset+=
4)
+ for (soffset
-= 4, doffset = 4; soffset > 3; soffset -= 4, doffset +=
4)
memcpy(&dptr[doffset-1], &start[soffset-1], 4);
/*
* RFC1812 requires to fix illegal source routes.
memcpy(&dptr[doffset-1], &start[soffset-1], 4);
/*
* RFC1812 requires to fix illegal source routes.
@@
-227,7
+227,7
@@
void ip_options_fragment(struct sk_buff *skb)
continue;
}
optlen = optptr[1];
continue;
}
optlen = optptr[1];
- if (optlen
<2 || optlen>
l)
+ if (optlen
< 2 || optlen >
l)
return;
if (!IPOPT_COPIED(*optptr))
memset(optptr, IPOPT_NOOP, optlen);
return;
if (!IPOPT_COPIED(*optptr))
memset(optptr, IPOPT_NOOP, optlen);
@@
-275,27
+275,27
@@
int ip_options_compile(struct net *net,
for (l = opt->optlen; l > 0; ) {
switch (*optptr) {
for (l = opt->optlen; l > 0; ) {
switch (*optptr) {
-
case IPOPT_END:
- for (optptr++, l--; l
>
0; optptr++, l--) {
+ case IPOPT_END:
+ for (optptr++, l--; l
>
0; optptr++, l--) {
if (*optptr != IPOPT_END) {
*optptr = IPOPT_END;
opt->is_changed = 1;
}
}
goto eol;
if (*optptr != IPOPT_END) {
*optptr = IPOPT_END;
opt->is_changed = 1;
}
}
goto eol;
-
case IPOPT_NOOP:
+ case IPOPT_NOOP:
l--;
optptr++;
continue;
}
optlen = optptr[1];
l--;
optptr++;
continue;
}
optlen = optptr[1];
- if (optlen
<2 || optlen>
l) {
+ if (optlen
< 2 || optlen >
l) {
pp_ptr = optptr;
goto error;
}
switch (*optptr) {
pp_ptr = optptr;
goto error;
}
switch (*optptr) {
-
case IPOPT_SSRR:
-
case IPOPT_LSRR:
+ case IPOPT_SSRR:
+ case IPOPT_LSRR:
if (optlen < 3) {
pp_ptr = optptr + 1;
goto error;
if (optlen < 3) {
pp_ptr = optptr + 1;
goto error;
@@
-321,7
+321,7
@@
int ip_options_compile(struct net *net,
opt->is_strictroute = (optptr[0] == IPOPT_SSRR);
opt->srr = optptr - iph;
break;
opt->is_strictroute = (optptr[0] == IPOPT_SSRR);
opt->srr = optptr - iph;
break;
-
case IPOPT_RR:
+ case IPOPT_RR:
if (opt->rr) {
pp_ptr = optptr;
goto error;
if (opt->rr) {
pp_ptr = optptr;
goto error;
@@
-349,7
+349,7
@@
int ip_options_compile(struct net *net,
}
opt->rr = optptr - iph;
break;
}
opt->rr = optptr - iph;
break;
-
case IPOPT_TIMESTAMP:
+ case IPOPT_TIMESTAMP:
if (opt->ts) {
pp_ptr = optptr;
goto error;
if (opt->ts) {
pp_ptr = optptr;
goto error;
@@
-369,19
+369,17
@@
int ip_options_compile(struct net *net,
goto error;
}
switch (optptr[3]&0xF) {
goto error;
}
switch (optptr[3]&0xF) {
- case IPOPT_TS_TSONLY:
- opt->ts = optptr - iph;
+ case IPOPT_TS_TSONLY:
if (skb)
timeptr = &optptr[optptr[2]-1];
opt->ts_needtime = 1;
optptr[2] += 4;
break;
if (skb)
timeptr = &optptr[optptr[2]-1];
opt->ts_needtime = 1;
optptr[2] += 4;
break;
-
case IPOPT_TS_TSANDADDR:
+ case IPOPT_TS_TSANDADDR:
if (optptr[2]+7 > optptr[1]) {
pp_ptr = optptr + 2;
goto error;
}
if (optptr[2]+7 > optptr[1]) {
pp_ptr = optptr + 2;
goto error;
}
- opt->ts = optptr - iph;
if (rt) {
spec_dst_fill(&spec_dst, skb);
memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
if (rt) {
spec_dst_fill(&spec_dst, skb);
memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
@@
-391,12
+389,11
@@
int ip_options_compile(struct net *net,
opt->ts_needtime = 1;
optptr[2] += 8;
break;
opt->ts_needtime = 1;
optptr[2] += 8;
break;
-
case IPOPT_TS_PRESPEC:
+ case IPOPT_TS_PRESPEC:
if (optptr[2]+7 > optptr[1]) {
pp_ptr = optptr + 2;
goto error;
}
if (optptr[2]+7 > optptr[1]) {
pp_ptr = optptr + 2;
goto error;
}
- opt->ts = optptr - iph;
{
__be32 addr;
memcpy(&addr, &optptr[optptr[2]-1], 4);
{
__be32 addr;
memcpy(&addr, &optptr[optptr[2]-1], 4);
@@
-408,7
+405,7
@@
int ip_options_compile(struct net *net,
opt->ts_needtime = 1;
optptr[2] += 8;
break;
opt->ts_needtime = 1;
optptr[2] += 8;
break;
-
default:
+ default:
if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
pp_ptr = optptr + 3;
goto error;
if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
pp_ptr = optptr + 3;
goto error;
@@
-429,14
+426,14
@@
int ip_options_compile(struct net *net,
pp_ptr = optptr + 3;
goto error;
}
pp_ptr = optptr + 3;
goto error;
}
- opt->ts = optptr - iph;
if (skb) {
optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
opt->is_changed = 1;
}
}
if (skb) {
optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
opt->is_changed = 1;
}
}
+ opt->ts = optptr - iph;
break;
break;
-
case IPOPT_RA:
+ case IPOPT_RA:
if (optlen < 4) {
pp_ptr = optptr + 1;
goto error;
if (optlen < 4) {
pp_ptr = optptr + 1;
goto error;
@@
-444,7
+441,7
@@
int ip_options_compile(struct net *net,
if (optptr[2] == 0 && optptr[3] == 0)
opt->router_alert = optptr - iph;
break;
if (optptr[2] == 0 && optptr[3] == 0)
opt->router_alert = optptr - iph;
break;
-
case IPOPT_CIPSO:
+ case IPOPT_CIPSO:
if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) {
pp_ptr = optptr;
goto error;
if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) {
pp_ptr = optptr;
goto error;
@@
-455,9
+452,9
@@
int ip_options_compile(struct net *net,
goto error;
}
break;
goto error;
}
break;
-
case IPOPT_SEC:
-
case IPOPT_SID:
-
default:
+ case IPOPT_SEC:
+ case IPOPT_SID:
+ default:
if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
pp_ptr = optptr;
goto error;
if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
pp_ptr = optptr;
goto error;
@@
-575,7
+572,7
@@
void ip_forward_options(struct sk_buff *skb)
optptr = raw + opt->srr;
optptr = raw + opt->srr;
- for ( srrptr
=
optptr[2], srrspace = optptr[1];
+ for ( srrptr
=
optptr[2], srrspace = optptr[1];
srrptr <= srrspace;
srrptr += 4
) {
srrptr <= srrspace;
srrptr += 4
) {
@@
-631,7
+628,7
@@
int ip_options_rcv_srr(struct sk_buff *skb)
if (rt->rt_type != RTN_LOCAL)
return -EINVAL;
if (rt->rt_type != RTN_LOCAL)
return -EINVAL;
- for (srrptr
=
optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) {
+ for (srrptr
=
optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) {
if (srrptr + 3 > srrspace) {
icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24));
return -EINVAL;
if (srrptr + 3 > srrspace) {
icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24));
return -EINVAL;