Skip to content

Commit 65a2022

Browse files
dsahernborkmann
authored andcommitted
net/ipv6: Add fib lookup stubs for use in bpf helper
Add stubs to retrieve a handle to an IPv6 FIB table, fib6_get_table, a stub to do a lookup in a specific table, fib6_table_lookup, and a stub for a full route lookup. The stubs are needed for core bpf code to handle the case when the IPv6 module is not builtin. Signed-off-by: David Ahern <dsahern@gmail.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent d4bea42 commit 65a2022

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

include/net/addrconf.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,20 @@ struct ipv6_stub {
223223
const struct in6_addr *addr);
224224
int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
225225
struct dst_entry **dst, struct flowi6 *fl6);
226+
227+
struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
228+
struct fib6_info *(*fib6_lookup)(struct net *net, int oif,
229+
struct flowi6 *fl6, int flags);
230+
struct fib6_info *(*fib6_table_lookup)(struct net *net,
231+
struct fib6_table *table,
232+
int oif, struct flowi6 *fl6,
233+
int flags);
234+
struct fib6_info *(*fib6_multipath_select)(const struct net *net,
235+
struct fib6_info *f6i,
236+
struct flowi6 *fl6, int oif,
237+
const struct sk_buff *skb,
238+
int strict);
239+
226240
void (*udpv6_encap_enable)(void);
227241
void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
228242
const struct in6_addr *solicited_addr,

net/ipv6/addrconf_core.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,39 @@ static int eafnosupport_ipv6_dst_lookup(struct net *net, struct sock *u1,
134134
return -EAFNOSUPPORT;
135135
}
136136

137+
static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id)
138+
{
139+
return NULL;
140+
}
141+
142+
static struct fib6_info *
143+
eafnosupport_fib6_table_lookup(struct net *net, struct fib6_table *table,
144+
int oif, struct flowi6 *fl6, int flags)
145+
{
146+
return NULL;
147+
}
148+
149+
static struct fib6_info *
150+
eafnosupport_fib6_lookup(struct net *net, int oif, struct flowi6 *fl6,
151+
int flags)
152+
{
153+
return NULL;
154+
}
155+
156+
static struct fib6_info *
157+
eafnosupport_fib6_multipath_select(const struct net *net, struct fib6_info *f6i,
158+
struct flowi6 *fl6, int oif,
159+
const struct sk_buff *skb, int strict)
160+
{
161+
return f6i;
162+
}
163+
137164
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
138-
.ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
165+
.ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
166+
.fib6_get_table = eafnosupport_fib6_get_table,
167+
.fib6_table_lookup = eafnosupport_fib6_table_lookup,
168+
.fib6_lookup = eafnosupport_fib6_lookup,
169+
.fib6_multipath_select = eafnosupport_fib6_multipath_select,
139170
};
140171
EXPORT_SYMBOL_GPL(ipv6_stub);
141172

net/ipv6/af_inet6.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,11 @@ static struct pernet_operations inet6_net_ops = {
889889
static const struct ipv6_stub ipv6_stub_impl = {
890890
.ipv6_sock_mc_join = ipv6_sock_mc_join,
891891
.ipv6_sock_mc_drop = ipv6_sock_mc_drop,
892-
.ipv6_dst_lookup = ip6_dst_lookup,
892+
.ipv6_dst_lookup = ip6_dst_lookup,
893+
.fib6_get_table = fib6_get_table,
894+
.fib6_table_lookup = fib6_table_lookup,
895+
.fib6_lookup = fib6_lookup,
896+
.fib6_multipath_select = fib6_multipath_select,
893897
.udpv6_encap_enable = udpv6_encap_enable,
894898
.ndisc_send_na = ndisc_send_na,
895899
.nd_tbl = &nd_tbl,

0 commit comments

Comments
 (0)