| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * IPv6 library code, needed by static components when full IPv6 support is |
|---|
| 3 | 4 | * not configured or static. |
|---|
| .. | .. |
|---|
| 5 | 6 | |
|---|
| 6 | 7 | #include <linux/export.h> |
|---|
| 7 | 8 | #include <net/ipv6.h> |
|---|
| 9 | +#include <net/ipv6_stubs.h> |
|---|
| 8 | 10 | #include <net/addrconf.h> |
|---|
| 9 | 11 | #include <net/ip.h> |
|---|
| 10 | 12 | |
|---|
| .. | .. |
|---|
| 135 | 137 | return ERR_PTR(-EAFNOSUPPORT); |
|---|
| 136 | 138 | } |
|---|
| 137 | 139 | |
|---|
| 140 | +static int eafnosupport_ipv6_route_input(struct sk_buff *skb) |
|---|
| 141 | +{ |
|---|
| 142 | + return -EAFNOSUPPORT; |
|---|
| 143 | +} |
|---|
| 144 | + |
|---|
| 138 | 145 | static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id) |
|---|
| 139 | 146 | { |
|---|
| 140 | 147 | return NULL; |
|---|
| 141 | 148 | } |
|---|
| 142 | 149 | |
|---|
| 143 | | -static struct fib6_info * |
|---|
| 150 | +static int |
|---|
| 144 | 151 | eafnosupport_fib6_table_lookup(struct net *net, struct fib6_table *table, |
|---|
| 145 | | - int oif, struct flowi6 *fl6, int flags) |
|---|
| 152 | + int oif, struct flowi6 *fl6, |
|---|
| 153 | + struct fib6_result *res, int flags) |
|---|
| 146 | 154 | { |
|---|
| 147 | | - return NULL; |
|---|
| 155 | + return -EAFNOSUPPORT; |
|---|
| 148 | 156 | } |
|---|
| 149 | 157 | |
|---|
| 150 | | -static struct fib6_info * |
|---|
| 158 | +static int |
|---|
| 151 | 159 | eafnosupport_fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, |
|---|
| 152 | | - int flags) |
|---|
| 160 | + struct fib6_result *res, int flags) |
|---|
| 153 | 161 | { |
|---|
| 154 | | - return NULL; |
|---|
| 162 | + return -EAFNOSUPPORT; |
|---|
| 155 | 163 | } |
|---|
| 156 | 164 | |
|---|
| 157 | | -static struct fib6_info * |
|---|
| 158 | | -eafnosupport_fib6_multipath_select(const struct net *net, struct fib6_info *f6i, |
|---|
| 159 | | - struct flowi6 *fl6, int oif, |
|---|
| 160 | | - const struct sk_buff *skb, int strict) |
|---|
| 165 | +static void |
|---|
| 166 | +eafnosupport_fib6_select_path(const struct net *net, struct fib6_result *res, |
|---|
| 167 | + struct flowi6 *fl6, int oif, bool have_oif_match, |
|---|
| 168 | + const struct sk_buff *skb, int strict) |
|---|
| 161 | 169 | { |
|---|
| 162 | | - return f6i; |
|---|
| 163 | 170 | } |
|---|
| 164 | 171 | |
|---|
| 165 | 172 | static u32 |
|---|
| 166 | | -eafnosupport_ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, |
|---|
| 167 | | - struct in6_addr *saddr) |
|---|
| 173 | +eafnosupport_ip6_mtu_from_fib6(const struct fib6_result *res, |
|---|
| 174 | + const struct in6_addr *daddr, |
|---|
| 175 | + const struct in6_addr *saddr) |
|---|
| 168 | 176 | { |
|---|
| 169 | 177 | return 0; |
|---|
| 170 | 178 | } |
|---|
| 171 | 179 | |
|---|
| 180 | +static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, |
|---|
| 181 | + struct fib6_config *cfg, gfp_t gfp_flags, |
|---|
| 182 | + struct netlink_ext_ack *extack) |
|---|
| 183 | +{ |
|---|
| 184 | + NL_SET_ERR_MSG(extack, "IPv6 support not enabled in kernel"); |
|---|
| 185 | + return -EAFNOSUPPORT; |
|---|
| 186 | +} |
|---|
| 187 | + |
|---|
| 188 | +static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt, |
|---|
| 189 | + bool skip_notify) |
|---|
| 190 | +{ |
|---|
| 191 | + return -EAFNOSUPPORT; |
|---|
| 192 | +} |
|---|
| 193 | + |
|---|
| 194 | +static int eafnosupport_ipv6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
|---|
| 195 | + int (*output)(struct net *, struct sock *, struct sk_buff *)) |
|---|
| 196 | +{ |
|---|
| 197 | + kfree_skb(skb); |
|---|
| 198 | + return -EAFNOSUPPORT; |
|---|
| 199 | +} |
|---|
| 200 | + |
|---|
| 172 | 201 | const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { |
|---|
| 173 | 202 | .ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow, |
|---|
| 203 | + .ipv6_route_input = eafnosupport_ipv6_route_input, |
|---|
| 174 | 204 | .fib6_get_table = eafnosupport_fib6_get_table, |
|---|
| 175 | 205 | .fib6_table_lookup = eafnosupport_fib6_table_lookup, |
|---|
| 176 | 206 | .fib6_lookup = eafnosupport_fib6_lookup, |
|---|
| 177 | | - .fib6_multipath_select = eafnosupport_fib6_multipath_select, |
|---|
| 207 | + .fib6_select_path = eafnosupport_fib6_select_path, |
|---|
| 178 | 208 | .ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6, |
|---|
| 209 | + .fib6_nh_init = eafnosupport_fib6_nh_init, |
|---|
| 210 | + .ip6_del_rt = eafnosupport_ip6_del_rt, |
|---|
| 211 | + .ipv6_fragment = eafnosupport_ipv6_fragment, |
|---|
| 179 | 212 | }; |
|---|
| 180 | 213 | EXPORT_SYMBOL_GPL(ipv6_stub); |
|---|
| 181 | 214 | |
|---|