diff options
Diffstat (limited to 'net/ipv4/ip_options.c')
-rw-r--r-- | net/ipv4/ip_options.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 2fa411381b11..aeed4e5858ec 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -255,17 +255,14 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
255 | unsigned char * optptr; | 255 | unsigned char * optptr; |
256 | int optlen; | 256 | int optlen; |
257 | unsigned char * pp_ptr = NULL; | 257 | unsigned char * pp_ptr = NULL; |
258 | struct rtable *rt = skb ? skb->rtable : NULL; | 258 | struct rtable *rt = NULL; |
259 | 259 | ||
260 | if (!opt) { | 260 | if (skb != NULL) { |
261 | opt = &(IPCB(skb)->opt); | 261 | rt = skb->rtable; |
262 | iph = skb_network_header(skb); | 262 | optptr = (unsigned char *)&(ip_hdr(skb)[1]); |
263 | opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr); | 263 | } else |
264 | optptr = iph + sizeof(struct iphdr); | ||
265 | } else { | ||
266 | optptr = opt->__data; | 264 | optptr = opt->__data; |
267 | iph = optptr - sizeof(struct iphdr); | 265 | iph = optptr - sizeof(struct iphdr); |
268 | } | ||
269 | 266 | ||
270 | for (l = opt->optlen; l > 0; ) { | 267 | for (l = opt->optlen; l > 0; ) { |
271 | switch (*optptr) { | 268 | switch (*optptr) { |