aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-03-22 19:36:20 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-22 19:36:20 -0400
commit22aba383ce52f8ca8740f9a74dc66b1b68138813 (patch)
treec9616eb776a515cac03e20eee11fed1ed84c6999 /net
parentef722495c8867aacc1db0675a6737e5cf1e72e07 (diff)
[IPV4]: Always pass ip_options pointer into ip_options_compile.
This makes code a bit more uniform and straigthforward. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_input.c5
-rw-r--r--net/ipv4/ip_options.c17
2 files changed, 10 insertions, 12 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d36e310b314d..e3a0c78fa7bf 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -283,13 +283,14 @@ static inline int ip_rcv_options(struct sk_buff *skb)
283 } 283 }
284 284
285 iph = ip_hdr(skb); 285 iph = ip_hdr(skb);
286 opt = &(IPCB(skb)->opt);
287 opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
286 288
287 if (ip_options_compile(NULL, skb)) { 289 if (ip_options_compile(opt, skb)) {
288 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); 290 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
289 goto drop; 291 goto drop;
290 } 292 }
291 293
292 opt = &(IPCB(skb)->opt);
293 if (unlikely(opt->srr)) { 294 if (unlikely(opt->srr)) {
294 struct in_device *in_dev = in_dev_get(dev); 295 struct in_device *in_dev = in_dev_get(dev);
295 if (in_dev) { 296 if (in_dev) {
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) {