fib6_rules.c (a25724b05af0e38232764fc0d0f984254e4b5c41) fib6_rules.c (b75cc8f90f07342467b3bd51dbc0054f185032c9)
1/*
2 * net/ipv6/fib6_rules.c IPv6 Routing Policy Rules
3 *
4 * Copyright (C)2003-2006 Helsinki University of Technology
5 * Copyright (C)2003-2006 USAGI/WIDE Project
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as

--- 47 unchanged lines hidden (view full) ---

56}
57
58unsigned int fib6_rules_seq_read(struct net *net)
59{
60 return fib_rules_seq_read(net, AF_INET6);
61}
62
63struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
1/*
2 * net/ipv6/fib6_rules.c IPv6 Routing Policy Rules
3 *
4 * Copyright (C)2003-2006 Helsinki University of Technology
5 * Copyright (C)2003-2006 USAGI/WIDE Project
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as

--- 47 unchanged lines hidden (view full) ---

56}
57
58unsigned int fib6_rules_seq_read(struct net *net)
59{
60 return fib_rules_seq_read(net, AF_INET6);
61}
62
63struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
64 const struct sk_buff *skb,
64 int flags, pol_lookup_t lookup)
65{
66 if (net->ipv6.fib6_has_custom_rules) {
67 struct fib_lookup_arg arg = {
68 .lookup_ptr = lookup,
65 int flags, pol_lookup_t lookup)
66{
67 if (net->ipv6.fib6_has_custom_rules) {
68 struct fib_lookup_arg arg = {
69 .lookup_ptr = lookup,
70 .lookup_data = skb,
69 .flags = FIB_LOOKUP_NOREF,
70 };
71
72 /* update flow if oif or iif point to device enslaved to l3mdev */
73 l3mdev_update_flow(net, flowi6_to_flowi(fl6));
74
75 fib_rules_lookup(net->ipv6.fib6_rules_ops,
76 flowi6_to_flowi(fl6), flags, &arg);
77
78 if (arg.result)
79 return arg.result;
80 } else {
81 struct rt6_info *rt;
82
71 .flags = FIB_LOOKUP_NOREF,
72 };
73
74 /* update flow if oif or iif point to device enslaved to l3mdev */
75 l3mdev_update_flow(net, flowi6_to_flowi(fl6));
76
77 fib_rules_lookup(net->ipv6.fib6_rules_ops,
78 flowi6_to_flowi(fl6), flags, &arg);
79
80 if (arg.result)
81 return arg.result;
82 } else {
83 struct rt6_info *rt;
84
83 rt = lookup(net, net->ipv6.fib6_local_tbl, fl6, flags);
85 rt = lookup(net, net->ipv6.fib6_local_tbl, fl6, skb, flags);
84 if (rt != net->ipv6.ip6_null_entry && rt->dst.error != -EAGAIN)
85 return &rt->dst;
86 ip6_rt_put(rt);
86 if (rt != net->ipv6.ip6_null_entry && rt->dst.error != -EAGAIN)
87 return &rt->dst;
88 ip6_rt_put(rt);
87 rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
89 rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, skb, flags);
88 if (rt->dst.error != -EAGAIN)
89 return &rt->dst;
90 ip6_rt_put(rt);
91 }
92
93 dst_hold(&net->ipv6.ip6_null_entry->dst);
94 return &net->ipv6.ip6_null_entry->dst;
95}

--- 29 unchanged lines hidden (view full) ---

125
126 tb_id = fib_rule_get_table(rule, arg);
127 table = fib6_get_table(net, tb_id);
128 if (!table) {
129 err = -EAGAIN;
130 goto out;
131 }
132
90 if (rt->dst.error != -EAGAIN)
91 return &rt->dst;
92 ip6_rt_put(rt);
93 }
94
95 dst_hold(&net->ipv6.ip6_null_entry->dst);
96 return &net->ipv6.ip6_null_entry->dst;
97}

--- 29 unchanged lines hidden (view full) ---

127
128 tb_id = fib_rule_get_table(rule, arg);
129 table = fib6_get_table(net, tb_id);
130 if (!table) {
131 err = -EAGAIN;
132 goto out;
133 }
134
133 rt = lookup(net, table, flp6, flags);
135 rt = lookup(net, table, flp6, arg->lookup_data, flags);
134 if (rt != net->ipv6.ip6_null_entry) {
135 struct fib6_rule *r = (struct fib6_rule *)rule;
136
137 /*
138 * If we need to find a source address for this traffic,
139 * we check the result if it meets requirement of the rule.
140 */
141 if ((rule->flags & FIB_RULE_FIND_SADDR) &&

--- 269 unchanged lines hidden ---
136 if (rt != net->ipv6.ip6_null_entry) {
137 struct fib6_rule *r = (struct fib6_rule *)rule;
138
139 /*
140 * If we need to find a source address for this traffic,
141 * we check the result if it meets requirement of the rule.
142 */
143 if ((rule->flags & FIB_RULE_FIND_SADDR) &&

--- 269 unchanged lines hidden ---