diff options
-rw-r--r-- | transporthandler.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/transporthandler.cpp b/transporthandler.cpp index 74d1817..fbd127f 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp @@ -1041,7 +1041,9 @@ uint8_t netmaskToPrefix(in_addr netmask) log<level::ERR>("Invalid netmask", entry("NETMASK=%s", maskStr)); elog<InternalFailure>(); } - return 32 - __builtin_ctz(x); + return static_cast<bool>(x) + ? AddrFamily<AF_INET>::defaultPrefix - __builtin_ctz(x) + : 0; } // We need to store this value so it can be returned to the client |