diff options
| author | David S. Miller <davem@sunset.davemloft.net> | 2005-03-19 00:45:16 -0800 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2005-03-19 00:45:16 -0800 |
| commit | 01945d9b23284f99d73830dd4765eb94948f38aa (patch) | |
| tree | c2ee4a808d5be4300dad80c27af4266ba37ebeff /include/net | |
| parent | 94c3085377ee20c2e7e6780d96c8cb39be11c0db (diff) | |
[IPV4]: Check multipath ops func pointers against NULL.
Multipath algorithms are not required to implement
all of the methods. Just the ones they need.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/ip_mp_alg.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h index 9431df22782c..637ae685ebae 100644 --- a/include/net/ip_mp_alg.h +++ b/include/net/ip_mp_alg.h @@ -36,7 +36,8 @@ static inline int multipath_select_route(const struct flowi *flp, #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED struct ip_mp_alg_ops *ops = ip_mp_alg_table[rth->rt_multipath_alg]; - if (ops && (rth->u.dst.flags & DST_BALANCED)) { + if (ops && ops->mp_alg_select_route && + (rth->u.dst.flags & DST_BALANCED)) { ops->mp_alg_select_route(flp, rth, rp); return 1; } @@ -52,7 +53,7 @@ static inline void multipath_flush(void) for (i = IP_MP_ALG_NONE; i <= IP_MP_ALG_MAX; i++) { struct ip_mp_alg_ops *ops = ip_mp_alg_table[i]; - if (ops) + if (ops && ops->mp_alg_flush) ops->mp_alg_flush(); } #endif @@ -66,7 +67,7 @@ static inline void multipath_set_nhinfo(struct rtable *rth, #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED struct ip_mp_alg_ops *ops = ip_mp_alg_table[rth->rt_multipath_alg]; - if (ops) + if (ops && ops->mp_alg_set_nhinfo) ops->mp_alg_set_nhinfo(network, netmask, prefixlen, nh); #endif } @@ -76,7 +77,8 @@ static inline void multipath_remove(struct rtable *rth) #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED struct ip_mp_alg_ops *ops = ip_mp_alg_table[rth->rt_multipath_alg]; - if (ops && (rth->u.dst.flags & DST_BALANCED)) + if (ops && ops->mp_alg_remove && + (rth->u.dst.flags & DST_BALANCED)) ops->mp_alg_remove(rth); #endif } |
