aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-03-24 18:29:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-24 18:29:23 -0400
commit0e6bd4a1c6c3881c9ed82985ecb9824d4450c4ba (patch)
tree6a8e2513b1c5b3285a559fccf70100b8fe8826e3
parentffc31d3d7719555cd784ecaf82e9c237f3a747ab (diff)
[NETNS]: Add namespace parameter to ip_options_compile.
ip_options_compile uses inet_addr_type which requires a namespace. The packet argument is optional, so parameter is the only way to obtain it. Pass the init_net there for now. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip.h3
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/ip_options.c7
3 files changed, 7 insertions, 5 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 9f50d4f1f157..bcc3afa3df36 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -347,7 +347,8 @@ extern int ip_forward(struct sk_buff *skb);
347extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); 347extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag);
348extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 348extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
349extern void ip_options_fragment(struct sk_buff *skb); 349extern void ip_options_fragment(struct sk_buff *skb);
350extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); 350extern int ip_options_compile(struct net *net,
351 struct ip_options *opt, struct sk_buff *skb);
351extern int ip_options_get(struct ip_options **optp, 352extern int ip_options_get(struct ip_options **optp,
352 unsigned char *data, int optlen); 353 unsigned char *data, int optlen);
353extern int ip_options_get_from_user(struct ip_options **optp, 354extern int ip_options_get_from_user(struct ip_options **optp,
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index e3a0c78fa7bf..f3a7a08a463f 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -286,7 +286,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
286 opt = &(IPCB(skb)->opt); 286 opt = &(IPCB(skb)->opt);
287 opt->optlen = iph->ihl*4 - sizeof(struct iphdr); 287 opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
288 288
289 if (ip_options_compile(opt, skb)) { 289 if (ip_options_compile(&init_net, opt, skb)) {
290 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); 290 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
291 goto drop; 291 goto drop;
292 } 292 }
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index aeed4e5858ec..f0949b42e79e 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -248,7 +248,8 @@ void ip_options_fragment(struct sk_buff * skb)
248 * If opt == NULL, then skb->data should point to IP header. 248 * If opt == NULL, then skb->data should point to IP header.
249 */ 249 */
250 250
251int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) 251int ip_options_compile(struct net *net,
252 struct ip_options * opt, struct sk_buff * skb)
252{ 253{
253 int l; 254 int l;
254 unsigned char * iph; 255 unsigned char * iph;
@@ -389,7 +390,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
389 { 390 {
390 __be32 addr; 391 __be32 addr;
391 memcpy(&addr, &optptr[optptr[2]-1], 4); 392 memcpy(&addr, &optptr[optptr[2]-1], 4);
392 if (inet_addr_type(&init_net, addr) == RTN_UNICAST) 393 if (inet_addr_type(net, addr) == RTN_UNICAST)
393 break; 394 break;
394 if (skb) 395 if (skb)
395 timeptr = (__be32*)&optptr[optptr[2]+3]; 396 timeptr = (__be32*)&optptr[optptr[2]+3];
@@ -512,7 +513,7 @@ static int ip_options_get_finish(struct ip_options **optp,
512 while (optlen & 3) 513 while (optlen & 3)
513 opt->__data[optlen++] = IPOPT_END; 514 opt->__data[optlen++] = IPOPT_END;
514 opt->optlen = optlen; 515 opt->optlen = optlen;
515 if (optlen && ip_options_compile(opt, NULL)) { 516 if (optlen && ip_options_compile(&init_net, opt, NULL)) {
516 kfree(opt); 517 kfree(opt);
517 return -EINVAL; 518 return -EINVAL;
518 } 519 }