Skip to content

Commit 1aefd3d

Browse files
dsaherndavem330
authored andcommitted
ipv6: Add fib6_nh_init and release to stubs
Add fib6_nh_init and fib6_nh_release to ipv6_stubs. If fib6_nh_init fails, callers should not invoke fib6_nh_release, so there is no reason to have a dummy stub for the IPv6 is not enabled case. Signed-off-by: David Ahern <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3b8b11f commit 1aefd3d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

include/net/ipv6_stubs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
/* structs from net/ip6_fib.h */
1414
struct fib6_info;
15+
struct fib6_nh;
16+
struct fib6_config;
1517

1618
/* This is ugly, ideally these symbols should be built
1719
* into the core kernel.
@@ -40,6 +42,10 @@ struct ipv6_stub {
4042
u32 (*ip6_mtu_from_fib6)(struct fib6_info *f6i, struct in6_addr *daddr,
4143
struct in6_addr *saddr);
4244

45+
int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh,
46+
struct fib6_config *cfg, gfp_t gfp_flags,
47+
struct netlink_ext_ack *extack);
48+
void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
4349
void (*udpv6_encap_enable)(void);
4450
void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
4551
const struct in6_addr *solicited_addr,

net/ipv6/addrconf_core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ eafnosupport_ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr,
173173
return 0;
174174
}
175175

176+
static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
177+
struct fib6_config *cfg, gfp_t gfp_flags,
178+
struct netlink_ext_ack *extack)
179+
{
180+
NL_SET_ERR_MSG(extack, "IPv6 support not enabled in kernel");
181+
return -EAFNOSUPPORT;
182+
}
183+
176184
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
177185
.ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup,
178186
.ipv6_route_input = eafnosupport_ipv6_route_input,
@@ -181,6 +189,7 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
181189
.fib6_lookup = eafnosupport_fib6_lookup,
182190
.fib6_multipath_select = eafnosupport_fib6_multipath_select,
183191
.ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6,
192+
.fib6_nh_init = eafnosupport_fib6_nh_init,
184193
};
185194
EXPORT_SYMBOL_GPL(ipv6_stub);
186195

net/ipv6/af_inet6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,8 @@ static const struct ipv6_stub ipv6_stub_impl = {
919919
.fib6_lookup = fib6_lookup,
920920
.fib6_multipath_select = fib6_multipath_select,
921921
.ip6_mtu_from_fib6 = ip6_mtu_from_fib6,
922+
.fib6_nh_init = fib6_nh_init,
923+
.fib6_nh_release = fib6_nh_release,
922924
.udpv6_encap_enable = udpv6_encap_enable,
923925
.ndisc_send_na = ndisc_send_na,
924926
.nd_tbl = &nd_tbl,

0 commit comments

Comments
 (0)