From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org, borkmann@iogearbox.net, ast@kernel.org
Cc: davem@davemloft.net, shm@cumulusnetworks.com,
roopa@cumulusnetworks.com, brouer@redhat.com, toke@toke.dk,
john.fastabend@gmail.com, David Ahern <dsahern@gmail.com>
Subject: [bpf-next v2 7/9] net/ipv6: Add fib lookup stubs for use in bpf helper
Date: Thu, 3 May 2018 19:54:30 -0700 [thread overview]
Message-ID: <20180504025432.23451-8-dsahern@gmail.com> (raw)
In-Reply-To: <20180504025432.23451-1-dsahern@gmail.com>
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>
---
include/net/addrconf.h | 14 ++++++++++++++
net/ipv6/addrconf_core.c | 33 ++++++++++++++++++++++++++++++++-
net/ipv6/af_inet6.c | 6 +++++-
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 8312cc25a3af..ff766ab207e0 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -223,6 +223,20 @@ struct ipv6_stub {
const struct in6_addr *addr);
int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
struct dst_entry **dst, struct flowi6 *fl6);
+
+ struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
+ struct fib6_info *(*fib6_lookup)(struct net *net, int oif,
+ struct flowi6 *fl6, int flags);
+ struct fib6_info *(*fib6_table_lookup)(struct net *net,
+ struct fib6_table *table,
+ int oif, struct flowi6 *fl6,
+ int flags);
+ struct fib6_info *(*fib6_multipath_select)(const struct net *net,
+ struct fib6_info *f6i,
+ struct flowi6 *fl6, int oif,
+ const struct sk_buff *skb,
+ int strict);
+
void (*udpv6_encap_enable)(void);
void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
const struct in6_addr *solicited_addr,
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index 32b564dfd02a..2fe754fd4f5e 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -134,8 +134,39 @@ static int eafnosupport_ipv6_dst_lookup(struct net *net, struct sock *u1,
return -EAFNOSUPPORT;
}
+static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id)
+{
+ return NULL;
+}
+
+static struct fib6_info *
+eafnosupport_fib6_table_lookup(struct net *net, struct fib6_table *table,
+ int oif, struct flowi6 *fl6, int flags)
+{
+ return NULL;
+}
+
+static struct fib6_info *
+eafnosupport_fib6_lookup(struct net *net, int oif, struct flowi6 *fl6,
+ int flags)
+{
+ return NULL;
+}
+
+static struct fib6_info *
+eafnosupport_fib6_multipath_select(const struct net *net, struct fib6_info *f6i,
+ struct flowi6 *fl6, int oif,
+ const struct sk_buff *skb, int strict)
+{
+ return f6i;
+}
+
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
- .ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
+ .ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
+ .fib6_get_table = eafnosupport_fib6_get_table,
+ .fib6_table_lookup = eafnosupport_fib6_table_lookup,
+ .fib6_lookup = eafnosupport_fib6_lookup,
+ .fib6_multipath_select = eafnosupport_fib6_multipath_select,
};
EXPORT_SYMBOL_GPL(ipv6_stub);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 36d622c477b1..c0e8255d50bb 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -887,7 +887,11 @@ static struct pernet_operations inet6_net_ops = {
static const struct ipv6_stub ipv6_stub_impl = {
.ipv6_sock_mc_join = ipv6_sock_mc_join,
.ipv6_sock_mc_drop = ipv6_sock_mc_drop,
- .ipv6_dst_lookup = ip6_dst_lookup,
+ .ipv6_dst_lookup = ip6_dst_lookup,
+ .fib6_get_table = fib6_get_table,
+ .fib6_table_lookup = fib6_table_lookup,
+ .fib6_lookup = fib6_lookup,
+ .fib6_multipath_select = fib6_multipath_select,
.udpv6_encap_enable = udpv6_encap_enable,
.ndisc_send_na = ndisc_send_na,
.nd_tbl = &nd_tbl,
--
2.11.0
next prev parent reply other threads:[~2018-05-04 2:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 2:54 [bpf-next v2 0/9] bpf: Add helper to do FIB lookups David Ahern
2018-05-04 2:54 ` [bpf-next v2 1/9] net/ipv6: Rename fib6_lookup to fib6_node_lookup David Ahern
2018-05-04 2:54 ` [bpf-next v2 2/9] net/ipv6: Rename rt6_multipath_select David Ahern
2018-05-04 2:54 ` [bpf-next v2 3/9] net/ipv6: Extract table lookup from ip6_pol_route David Ahern
2018-05-04 2:54 ` [bpf-next v2 4/9] net/ipv6: Refactor fib6_rule_action David Ahern
2018-05-04 2:54 ` [bpf-next v2 5/9] net/ipv6: Add fib6_lookup David Ahern
2018-05-04 2:54 ` [bpf-next v2 6/9] net/ipv6: Update fib6 tracepoint to take fib6_info David Ahern
2018-05-04 2:54 ` David Ahern [this message]
2018-05-04 2:54 ` [bpf-next v2 8/9] bpf: Provide helper to do forwarding lookups in kernel FIB table David Ahern
2018-05-07 13:35 ` Jesper Dangaard Brouer
2018-05-07 14:10 ` Daniel Borkmann
2018-05-07 14:26 ` David Ahern
2018-05-07 15:36 ` David Miller
2018-05-09 8:15 ` Daniel Borkmann
2018-05-09 16:05 ` David Ahern
2018-05-09 20:44 ` Daniel Borkmann
2018-05-09 21:29 ` David Ahern
2018-05-09 21:39 ` David Ahern
2018-05-09 21:49 ` Alexei Starovoitov
2018-05-09 21:49 ` Daniel Borkmann
2018-05-04 2:54 ` [bpf-next v2 9/9] samples/bpf: Add example of ipv4 and ipv6 forwarding in XDP David Ahern
2018-05-08 23:53 ` [bpf-next v2 0/9] bpf: Add helper to do FIB lookups Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180504025432.23451-8-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=ast@kernel.org \
--cc=borkmann@iogearbox.net \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=shm@cumulusnetworks.com \
--cc=toke@toke.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).