On 28/05/14(Wed) 09:30, Jérémie Courrèges-Anglas wrote:
> Martin Pieuchot <mpieuc...@nolizard.org> writes:
> 
> > Diff below replace in_iawithaddr() + in_broadcast() -> ifa_ifwithaddr(),
> > that does the same for IPv4 since broadcast addresses are added to the
> > tree.
> 
> This prevents listeners to bind on 255.255.255.255, something allowed
> with the current code.  Thoughts?

You're right, here's an updated diff that keeps this behavior.

Index: netinet/raw_ip.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.72
diff -u -p -r1.72 raw_ip.c
--- netinet/raw_ip.c    21 Apr 2014 12:22:26 -0000      1.72
+++ netinet/raw_ip.c    28 May 2014 11:35:15 -0000
@@ -465,9 +465,9 @@ rip_usrreq(struct socket *so, int req, s
                        break;
                }
                if (!((so->so_options & SO_BINDANY) ||
-                   addr->sin_addr.s_addr == 0 ||
-                   in_iawithaddr(addr->sin_addr, inp->inp_rtableid) ||
-                   in_broadcast(addr->sin_addr, NULL, inp->inp_rtableid))) {
+                   addr->sin_addr.s_addr == INADDR_ANY ||
+                   addr->sin_addr.s_addr == INADDR_BROADCAST ||
+                   ifa_ifwithaddr(sintosa(addr), inp->inp_rtableid))) {
                        error = EADDRNOTAVAIL;
                        break;
                }

Reply via email to