diff options
author | deischen <deischen@FreeBSD.org> | 2011-01-26 17:31:03 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2011-01-26 17:31:03 +0000 |
commit | 3025829199ee96f6ccfc793677651551690e8e2d (patch) | |
tree | 1b8667201e9a51d6d4ca4706f6efe3cfeb30b9be /sys/netinet/in_pcb.c | |
parent | f55144364336103ed725e72684be131b0d9431a2 (diff) | |
download | FreeBSD-src-3025829199ee96f6ccfc793677651551690e8e2d.zip FreeBSD-src-3025829199ee96f6ccfc793677651551690e8e2d.tar.gz |
Prison check addresses set with multicast interface options.
Reviewed by: bz
MFC after: 1 week
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 28cc029..4e3a9a8 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -889,17 +889,20 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam, if (imo->imo_multicast_ifp != NULL) { ifp = imo->imo_multicast_ifp; IN_IFADDR_RLOCK(); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) - if (ia->ia_ifp == ifp) + TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + if ((ia->ia_ifp == ifp) && + (cred == NULL || + prison_check_ip4(cred, + &ia->ia_addr.sin_addr) == 0)) break; - if (ia == NULL) { - IN_IFADDR_RUNLOCK(); + } + if (ia == NULL) error = EADDRNOTAVAIL; - } else { + else { laddr = ia->ia_addr.sin_addr; - IN_IFADDR_RUNLOCK(); error = 0; } + IN_IFADDR_RUNLOCK(); } } if (error) |