Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97665
b: refs/heads/master
c: 187e383
h: refs/heads/master
i:
  97663: 1c219dd
v: v3
  • Loading branch information
YOSHIFUJI Hideaki committed Jun 4, 2008
1 parent 4171be0 commit 81eb9c4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 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: 95b496b66615d8c43f77702049b1bd01e2f06595
refs/heads/master: 187e38384c4abfbbb1b880fab234d16c2df23a25
42 changes: 22 additions & 20 deletions trunk/net/ipv6/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,

for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
int addr_type;
struct net_device *dev = NULL;

if (!CMSG_OK(msg, cmsg)) {
err = -EINVAL;
Expand All @@ -522,6 +521,9 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
switch (cmsg->cmsg_type) {
case IPV6_PKTINFO:
case IPV6_2292PKTINFO:
{
struct net_device *dev = NULL;

if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) {
err = -EINVAL;
goto exit_f;
Expand All @@ -535,32 +537,32 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
fl->oif = src_info->ipi6_ifindex;
}

addr_type = ipv6_addr_type(&src_info->ipi6_addr);
addr_type = __ipv6_addr_type(&src_info->ipi6_addr);

if (addr_type == IPV6_ADDR_ANY)
break;
if (fl->oif) {
dev = dev_get_by_index(&init_net, fl->oif);
if (!dev)
return -ENODEV;
} else if (addr_type & IPV6_ADDR_LINKLOCAL)
return -EINVAL;

if (addr_type & IPV6_ADDR_LINKLOCAL) {
if (!src_info->ipi6_ifindex)
return -EINVAL;
else {
dev = dev_get_by_index(&init_net, src_info->ipi6_ifindex);
if (!dev)
return -ENODEV;
}
}
if (!ipv6_chk_addr(&init_net, &src_info->ipi6_addr,
dev, 0)) {
if (dev)
dev_put(dev);
err = -EINVAL;
goto exit_f;
if (addr_type != IPV6_ADDR_ANY) {
int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
if (!ipv6_chk_addr(&init_net, &src_info->ipi6_addr,
strict ? dev : NULL, 0))
err = -EINVAL;
else
ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr);
}

if (dev)
dev_put(dev);

ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr);
if (err)
goto exit_f;

break;
}

case IPV6_FLOWINFO:
if (cmsg->cmsg_len < CMSG_LEN(4)) {
Expand Down

0 comments on commit 81eb9c4

Please sign in to comment.