diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-04-28 07:10:04 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-04-28 07:10:04 +0000 |
commit | d2c4613b4a9ed0f4178d481c458f1acbd6b1234f (patch) | |
tree | 43106b26f29cac0f3ea92d7113941ee4995d90ca /sys/netinet/in_pcb.c | |
parent | fa9d7b6082456caf8e490d50bc5d343277a2c67b (diff) |
Allow SOCK_DGRAM sockets to be bound to the local network broadcast addr.
These sockets will only see broadcast sent to that particular address.
Some applications like samba use this feature.
Problem found and initial version by sthen@, OK sthen@, henning@
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index b372fdcecc9..50dced25268 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.117 2011/04/24 19:36:54 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.118 2011/04/28 07:10:03 claudio Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -278,7 +278,10 @@ in_pcbbind(v, nam, p) if (!(so->so_options & SO_BINDANY) && in_iawithaddr(sin->sin_addr, inp->inp_rtableid) == NULL) - return (EADDRNOTAVAIL); + /* SOCK_RAW does not use in_pcbbind() */ + if (!(so->so_type == SOCK_DGRAM && + in_broadcast(sin->sin_addr, NULL))) + return (EADDRNOTAVAIL); } if (lport) { struct inpcb *t; |