Add NULL pointer check.
encap_lookup_t method can be invoked by IP encap subsytem even if none of gif/gre/me interfaces are exist. Hash tables are allocated on demand, when first interface is created. So, make NULL pointer check before doing access to hash table. PR: 229378
This commit is contained in:
parent
0df37a208c
commit
6e081509db
@ -312,6 +312,9 @@ me_lookup(const struct mbuf *m, int off, int proto, void **arg)
|
||||
const struct ip *ip;
|
||||
struct me_softc *sc;
|
||||
|
||||
if (V_me_hashtbl == NULL)
|
||||
return (0);
|
||||
|
||||
MPASS(in_epoch());
|
||||
ip = mtod(m, const struct ip *);
|
||||
CK_LIST_FOREACH(sc, &ME_HASH(ip->ip_dst.s_addr,
|
||||
|
@ -289,6 +289,9 @@ in_gif_lookup(const struct mbuf *m, int off, int proto, void **arg)
|
||||
struct gif_softc *sc;
|
||||
int ret;
|
||||
|
||||
if (V_ipv4_hashtbl == NULL)
|
||||
return (0);
|
||||
|
||||
MPASS(in_epoch());
|
||||
ip = mtod(m, const struct ip *);
|
||||
/*
|
||||
|
@ -115,6 +115,9 @@ in_gre_lookup(const struct mbuf *m, int off, int proto, void **arg)
|
||||
const struct ip *ip;
|
||||
struct gre_softc *sc;
|
||||
|
||||
if (V_ipv4_hashtbl == NULL)
|
||||
return (0);
|
||||
|
||||
MPASS(in_epoch());
|
||||
ip = mtod(m, const struct ip *);
|
||||
CK_LIST_FOREACH(sc, &GRE_HASH(ip->ip_dst.s_addr,
|
||||
|
@ -309,6 +309,9 @@ in6_gif_lookup(const struct mbuf *m, int off, int proto, void **arg)
|
||||
struct gif_softc *sc;
|
||||
int ret;
|
||||
|
||||
if (V_ipv6_hashtbl == NULL)
|
||||
return (0);
|
||||
|
||||
MPASS(in_epoch());
|
||||
/*
|
||||
* NOTE: it is safe to iterate without any locking here, because softc
|
||||
|
@ -107,6 +107,9 @@ in6_gre_lookup(const struct mbuf *m, int off, int proto, void **arg)
|
||||
const struct ip6_hdr *ip6;
|
||||
struct gre_softc *sc;
|
||||
|
||||
if (V_ipv6_hashtbl == NULL)
|
||||
return (0);
|
||||
|
||||
MPASS(in_epoch());
|
||||
ip6 = mtod(m, const struct ip6_hdr *);
|
||||
CK_LIST_FOREACH(sc, &GRE_HASH(&ip6->ip6_dst, &ip6->ip6_src), chain) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user