Skip to content

Commit 9b0a6a9

Browse files
posk-ioAlexei Starovoitov
authored andcommitted
ipv6_stub: add ipv6_route_input stub/proxy.
Proxy ip6_route_input via ipv6_stub, for later use by lwt bpf ip encap (see the next patch in the patchset). Signed-off-by: Peter Oskolkov <posk@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent ca78801 commit 9b0a6a9

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎include/net/addrconf.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ struct ipv6_stub {
248248
const struct in6_addr *addr);
249249
int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
250250
struct dst_entry **dst, struct flowi6 *fl6);
251+
int (*ipv6_route_input)(struct sk_buff *skb);
251252

252253
struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
253254
struct fib6_info *(*fib6_lookup)(struct net *net, int oif,

‎net/ipv6/addrconf_core.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ static int eafnosupport_ipv6_dst_lookup(struct net *net, struct sock *u1,
134134
return -EAFNOSUPPORT;
135135
}
136136

137+
static int eafnosupport_ipv6_route_input(struct sk_buff *skb)
138+
{
139+
return -EAFNOSUPPORT;
140+
}
141+
137142
static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id)
138143
{
139144
return NULL;
@@ -170,6 +175,7 @@ eafnosupport_ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr,
170175

171176
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
172177
.ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
178+
.ipv6_route_input = eafnosupport_ipv6_route_input,
173179
.fib6_get_table = eafnosupport_fib6_get_table,
174180
.fib6_table_lookup = eafnosupport_fib6_table_lookup,
175181
.fib6_lookup = eafnosupport_fib6_lookup,

‎net/ipv6/af_inet6.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,17 @@ static struct pernet_operations inet6_net_ops = {
900900
.exit = inet6_net_exit,
901901
};
902902

903+
static int ipv6_route_input(struct sk_buff *skb)
904+
{
905+
ip6_route_input(skb);
906+
return skb_dst(skb)->error;
907+
}
908+
903909
static const struct ipv6_stub ipv6_stub_impl = {
904910
.ipv6_sock_mc_join = ipv6_sock_mc_join,
905911
.ipv6_sock_mc_drop = ipv6_sock_mc_drop,
906912
.ipv6_dst_lookup = ip6_dst_lookup,
913+
.ipv6_route_input = ipv6_route_input,
907914
.fib6_get_table = fib6_get_table,
908915
.fib6_table_lookup = fib6_table_lookup,
909916
.fib6_lookup = fib6_lookup,

0 commit comments

Comments
 (0)