aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_options.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-03-24 18:29:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-24 18:29:55 -0400
commitf2c4802b3fdfb0d9596d932ca2af0ef6f8d60491 (patch)
treeb6bf506c01a921040c8d91ff8507465ebdcd72e3 /net/ipv4/ip_options.c
parent0e6bd4a1c6c3881c9ed82985ecb9824d4450c4ba (diff)
[NETNS]: Add namespace parameter to ip_options_get(...).
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>
Diffstat (limited to 'net/ipv4/ip_options.c')
-rw-r--r--net/ipv4/ip_options.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index f0949b42e79e..59f7ddfb29bf 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -507,13 +507,13 @@ static struct ip_options *ip_options_get_alloc(const int optlen)
507 GFP_KERNEL); 507 GFP_KERNEL);
508} 508}
509 509
510static int ip_options_get_finish(struct ip_options **optp, 510static int ip_options_get_finish(struct net *net, struct ip_options **optp,
511 struct ip_options *opt, int optlen) 511 struct ip_options *opt, int optlen)
512{ 512{
513 while (optlen & 3) 513 while (optlen & 3)
514 opt->__data[optlen++] = IPOPT_END; 514 opt->__data[optlen++] = IPOPT_END;
515 opt->optlen = optlen; 515 opt->optlen = optlen;
516 if (optlen && ip_options_compile(&init_net, opt, NULL)) { 516 if (optlen && ip_options_compile(net, opt, NULL)) {
517 kfree(opt); 517 kfree(opt);
518 return -EINVAL; 518 return -EINVAL;
519 } 519 }
@@ -522,7 +522,8 @@ static int ip_options_get_finish(struct ip_options **optp,
522 return 0; 522 return 0;
523} 523}
524 524
525int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *data, int optlen) 525int ip_options_get_from_user(struct net *net, struct ip_options **optp,
526 unsigned char __user *data, int optlen)
526{ 527{
527 struct ip_options *opt = ip_options_get_alloc(optlen); 528 struct ip_options *opt = ip_options_get_alloc(optlen);
528 529
@@ -532,10 +533,11 @@ int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *dat
532 kfree(opt); 533 kfree(opt);
533 return -EFAULT; 534 return -EFAULT;
534 } 535 }
535 return ip_options_get_finish(optp, opt, optlen); 536 return ip_options_get_finish(net, optp, opt, optlen);
536} 537}
537 538
538int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen) 539int ip_options_get(struct net *net, struct ip_options **optp,
540 unsigned char *data, int optlen)
539{ 541{
540 struct ip_options *opt = ip_options_get_alloc(optlen); 542 struct ip_options *opt = ip_options_get_alloc(optlen);
541 543
@@ -543,7 +545,7 @@ int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen)
543 return -ENOMEM; 545 return -ENOMEM;
544 if (optlen) 546 if (optlen)
545 memcpy(opt->__data, data, optlen); 547 memcpy(opt->__data, data, optlen);
546 return ip_options_get_finish(optp, opt, optlen); 548 return ip_options_get_finish(net, optp, opt, optlen);
547} 549}
548 550
549void ip_forward_options(struct sk_buff *skb) 551void ip_forward_options(struct sk_buff *skb)