Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90267
b: refs/heads/master
c: f2c4802
h: refs/heads/master
i:
  90265: 9d929c3
  90263: 1f85673
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Mar 24, 2008
1 parent a2085de commit e1ca933
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 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: 0e6bd4a1c6c3881c9ed82985ecb9824d4450c4ba
refs/heads/master: f2c4802b3fdfb0d9596d932ca2af0ef6f8d60491
4 changes: 2 additions & 2 deletions trunk/include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
extern void ip_options_fragment(struct sk_buff *skb);
extern int ip_options_compile(struct net *net,
struct ip_options *opt, struct sk_buff *skb);
extern int ip_options_get(struct ip_options **optp,
extern int ip_options_get(struct net *net, struct ip_options **optp,
unsigned char *data, int optlen);
extern int ip_options_get_from_user(struct ip_options **optp,
extern int ip_options_get_from_user(struct net *net, struct ip_options **optp,
unsigned char __user *data, int optlen);
extern void ip_options_undo(struct ip_options * opt);
extern void ip_forward_options(struct sk_buff *skb);
Expand Down
14 changes: 8 additions & 6 deletions trunk/net/ipv4/ip_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ static struct ip_options *ip_options_get_alloc(const int optlen)
GFP_KERNEL);
}

static int ip_options_get_finish(struct ip_options **optp,
static int ip_options_get_finish(struct net *net, struct ip_options **optp,
struct ip_options *opt, int optlen)
{
while (optlen & 3)
opt->__data[optlen++] = IPOPT_END;
opt->optlen = optlen;
if (optlen && ip_options_compile(&init_net, opt, NULL)) {
if (optlen && ip_options_compile(net, opt, NULL)) {
kfree(opt);
return -EINVAL;
}
Expand All @@ -522,7 +522,8 @@ static int ip_options_get_finish(struct ip_options **optp,
return 0;
}

int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *data, int optlen)
int ip_options_get_from_user(struct net *net, struct ip_options **optp,
unsigned char __user *data, int optlen)
{
struct ip_options *opt = ip_options_get_alloc(optlen);

Expand All @@ -532,18 +533,19 @@ int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *dat
kfree(opt);
return -EFAULT;
}
return ip_options_get_finish(optp, opt, optlen);
return ip_options_get_finish(net, optp, opt, optlen);
}

int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen)
int ip_options_get(struct net *net, struct ip_options **optp,
unsigned char *data, int optlen)
{
struct ip_options *opt = ip_options_get_alloc(optlen);

if (!opt)
return -ENOMEM;
if (optlen)
memcpy(opt->__data, data, optlen);
return ip_options_get_finish(optp, opt, optlen);
return ip_options_get_finish(net, optp, opt, optlen);
}

void ip_forward_options(struct sk_buff *skb)
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc)
switch (cmsg->cmsg_type) {
case IP_RETOPTS:
err = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr));
err = ip_options_get(&ipc->opt, CMSG_DATA(cmsg), err < 40 ? err : 40);
err = ip_options_get(&init_net, &ipc->opt, CMSG_DATA(cmsg), err < 40 ? err : 40);
if (err)
return err;
break;
Expand Down Expand Up @@ -449,7 +449,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
struct ip_options * opt = NULL;
if (optlen > 40 || optlen < 0)
goto e_inval;
err = ip_options_get_from_user(&opt, optval, optlen);
err = ip_options_get_from_user(&init_net, &opt, optval, optlen);
if (err)
break;
if (inet->is_icsk) {
Expand Down

0 comments on commit e1ca933

Please sign in to comment.