Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314981
b: refs/heads/master
c: bf5e53e
h: refs/heads/master
i:
  314979: 213e39d
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jul 5, 2012
1 parent e685efe commit 5e782f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 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: 36bdbcae2fa2a6dfa99344d4190fcea0aa7b7c25
refs/heads/master: bf5e53e3717ed28be69d0663c65962d1731e7ee4
15 changes: 12 additions & 3 deletions trunk/net/ipv4/ip_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ void ip_options_fragment(struct sk_buff *skb)
opt->ts_needtime = 0;
}

/* helper used by ip_options_compile() to call fib_compute_spec_dst()
* at most one time.
*/
static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb)
{
if (*spec_dst == htonl(INADDR_ANY))
*spec_dst = fib_compute_spec_dst(skb);
}

/*
* Verify options and fill pointers in struct options.
* Caller should clear *opt, and set opt->data.
Expand All @@ -251,7 +260,7 @@ void ip_options_fragment(struct sk_buff *skb)
int ip_options_compile(struct net *net,
struct ip_options *opt, struct sk_buff *skb)
{
__be32 spec_dst = (__force __be32) 0;
__be32 spec_dst = htonl(INADDR_ANY);
unsigned char *pp_ptr = NULL;
struct rtable *rt = NULL;
unsigned char *optptr;
Expand All @@ -260,8 +269,6 @@ int ip_options_compile(struct net *net,

if (skb != NULL) {
rt = skb_rtable(skb);
if (rt)
spec_dst = fib_compute_spec_dst(skb);
optptr = (unsigned char *)&(ip_hdr(skb)[1]);
} else
optptr = opt->__data;
Expand Down Expand Up @@ -334,6 +341,7 @@ int ip_options_compile(struct net *net,
goto error;
}
if (rt) {
spec_dst_fill(&spec_dst, skb);
memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
opt->is_changed = 1;
}
Expand Down Expand Up @@ -376,6 +384,7 @@ int ip_options_compile(struct net *net,
}
opt->ts = optptr - iph;
if (rt) {
spec_dst_fill(&spec_dst, skb);
memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
timeptr = &optptr[optptr[2]+3];
}
Expand Down

0 comments on commit 5e782f0

Please sign in to comment.