The len2mask4 function was introduced in commit:
70473a5f8c56d8ec2e837b9b66443dc252b24da9
which is about six years later than the commit that introduced the
str2mask function:
2937c0dd20f2f3c0065b671bbfe3fafcd8862eaf

This is a clean up in preparation for a str2mask6 function which
will use len2mask6.
---
 src/standard.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/standard.c b/src/standard.c
index acd136c27..495bae571 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -1022,10 +1022,8 @@ int str2mask(const char *str, struct in_addr *mask)
 
                if (!*str || (err && *err) || (unsigned)len > 32)
                        return 0;
-               if (len)
-                       mask->s_addr = htonl(~0UL << (32 - len));
-               else
-                       mask->s_addr = 0;
+
+               len2mask4(len, mask);
        }
        return 1;
 }
-- 
2.15.1


Reply via email to