Commit 1973a4ea authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

net: ipmr: move pimsm_enabled to pim.h and rename

Move the inline pimsm_enabled() to pim.h and rename it to
ipmr_pimsm_enabled to show it's for the ipv4 ipmr code since pim.h is
used by IPv6 too.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5ea1f132
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
#define PIM_NULL_REGISTER cpu_to_be32(0x40000000) #define PIM_NULL_REGISTER cpu_to_be32(0x40000000)
static inline bool ipmr_pimsm_enabled(void)
{
return IS_BUILTIN(CONFIG_IP_PIMSM_V1) || IS_BUILTIN(CONFIG_IP_PIMSM_V2);
}
/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
struct pimreghdr struct pimreghdr
{ {
......
...@@ -75,11 +75,6 @@ struct ipmr_result { ...@@ -75,11 +75,6 @@ struct ipmr_result {
struct mr_table *mrt; struct mr_table *mrt;
}; };
static inline bool pimsm_enabled(void)
{
return IS_BUILTIN(CONFIG_IP_PIMSM_V1) || IS_BUILTIN(CONFIG_IP_PIMSM_V2);
}
/* Big lock, protecting vif table, mrt cache and mroute socket state. /* Big lock, protecting vif table, mrt cache and mroute socket state.
* Note that the changes are semaphored via rtnl_lock. * Note that the changes are semaphored via rtnl_lock.
*/ */
...@@ -751,7 +746,7 @@ static int vif_add(struct net *net, struct mr_table *mrt, ...@@ -751,7 +746,7 @@ static int vif_add(struct net *net, struct mr_table *mrt,
switch (vifc->vifc_flags) { switch (vifc->vifc_flags) {
case VIFF_REGISTER: case VIFF_REGISTER:
if (!pimsm_enabled()) if (!ipmr_pimsm_enabled())
return -EINVAL; return -EINVAL;
/* Special Purpose VIF in PIM /* Special Purpose VIF in PIM
* All the packets will be sent to the daemon * All the packets will be sent to the daemon
...@@ -1377,7 +1372,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, ...@@ -1377,7 +1372,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
mrt->mroute_do_assert = val; mrt->mroute_do_assert = val;
break; break;
case MRT_PIM: case MRT_PIM:
if (!pimsm_enabled()) { if (!ipmr_pimsm_enabled()) {
ret = -ENOPROTOOPT; ret = -ENOPROTOOPT;
break; break;
} }
...@@ -1451,7 +1446,7 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int ...@@ -1451,7 +1446,7 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int
val = 0x0305; val = 0x0305;
break; break;
case MRT_PIM: case MRT_PIM:
if (!pimsm_enabled()) if (!ipmr_pimsm_enabled())
return -ENOPROTOOPT; return -ENOPROTOOPT;
val = mrt->mroute_do_pim; val = mrt->mroute_do_pim;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment