Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327821
b: refs/heads/master
c: ef2c7d7
h: refs/heads/master
i:
  327819: 4dea18d
v: v3
  • Loading branch information
Nicolas Dichtel authored and David S. Miller committed Sep 5, 2012
1 parent 6245ab5 commit a069e67
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 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: d6b6d987787876fd381bfeda310c6682d425c0a2
refs/heads/master: ef2c7d7b59708d54213c7556a82d14de9a7e4475
1 change: 1 addition & 0 deletions trunk/include/net/ip6_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct fib6_config {
int fc_ifindex;
u32 fc_flags;
u32 fc_protocol;
u32 fc_type; /* only 8 bits are used */

struct in6_addr fc_dst;
struct in6_addr fc_src;
Expand Down
32 changes: 28 additions & 4 deletions trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1463,8 +1463,18 @@ int ip6_route_add(struct fib6_config *cfg)
}
rt->dst.output = ip6_pkt_discard_out;
rt->dst.input = ip6_pkt_discard;
rt->dst.error = -ENETUNREACH;
rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP;
switch (cfg->fc_type) {
case RTN_BLACKHOLE:
rt->dst.error = -EINVAL;
break;
case RTN_PROHIBIT:
rt->dst.error = -EACCES;
break;
default:
rt->dst.error = -ENETUNREACH;
break;
}
goto install_route;
}

Expand Down Expand Up @@ -2261,8 +2271,11 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
cfg->fc_src_len = rtm->rtm_src_len;
cfg->fc_flags = RTF_UP;
cfg->fc_protocol = rtm->rtm_protocol;
cfg->fc_type = rtm->rtm_type;

if (rtm->rtm_type == RTN_UNREACHABLE)
if (rtm->rtm_type == RTN_UNREACHABLE ||
rtm->rtm_type == RTN_BLACKHOLE ||
rtm->rtm_type == RTN_PROHIBIT)
cfg->fc_flags |= RTF_REJECT;

if (rtm->rtm_type == RTN_LOCAL)
Expand Down Expand Up @@ -2391,8 +2404,19 @@ static int rt6_fill_node(struct net *net,
rtm->rtm_table = table;
if (nla_put_u32(skb, RTA_TABLE, table))
goto nla_put_failure;
if (rt->rt6i_flags & RTF_REJECT)
rtm->rtm_type = RTN_UNREACHABLE;
if (rt->rt6i_flags & RTF_REJECT) {
switch (rt->dst.error) {
case -EINVAL:
rtm->rtm_type = RTN_BLACKHOLE;
break;
case -EACCES:
rtm->rtm_type = RTN_PROHIBIT;
break;
default:
rtm->rtm_type = RTN_UNREACHABLE;
break;
}
}
else if (rt->rt6i_flags & RTF_LOCAL)
rtm->rtm_type = RTN_LOCAL;
else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
Expand Down

0 comments on commit a069e67

Please sign in to comment.