Bug 31947

Summary: [PATCH] syslogd -a 0.0.0.0/0 behaves incorrect
Product: Base System Reporter: edwin
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: aaronsca
Priority: Normal    
Version: 4.4-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description edwin 2001-11-13 04:00:00 UTC
The behaviour of syslogd when specifieng 0.0.0.0/0 is incorrect.

Fix: thanks to Aaron Scarisbrick for his 4.2 fix.


For in the 4.4 release:
For -current:


Please note that the version -current isn't tested by me.--kyTYGpHrhztTTvhWHQ4B5EdnuGgAgorP1be4m9TWh0YtrWUN
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- ../syslogd-4.4/syslogd.c    Tue Nov 13 14:27:50 2001
+++ syslogd.c   Tue Nov 13 14:30:31 2001
@@ -1884,7 +1884,10 @@
                                        maskp->s_addr = htonl(IN_CLASSC_NET);
                        } else if (masklen <= 32) {
                                /* convert masklen to netmask */
-                               maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1));
+                               if (masklen == 0)
+                                       maskp->s_addr = 0;
+                               else
+                                       maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1));
                        } else {
                                freeaddrinfo(res);
                                return -1;
How-To-Repeat: [/usr/src/usr.sbin/syslogd] edwin@k7>./syslogd -d -a 0.0.0.0/0 gives:
allowaddr: rule 0: numeric, addr = 0.0.0.0, mask = 255.255.255.255; port = 514

this should be:
[/usr/src/usr.sbin/syslogd] edwin@k7>./syslogd -d -a 0.0.0.0/0
allowaddr: rule 0: numeric, addr = 0.0.0.0, mask = 0.0.0.0; port = 514
Comment 1 ps freebsd_committer freebsd_triage 2001-11-14 09:20:39 UTC
State Changed
From-To: open->closed

committed to -current