- Update bindx address checking to properly screen out address

per the socket api, adding port validation. We allow port 0
  or the already bound port number and no others.

Approved by:	re@freebsd.org (Ken Smith)
This commit is contained in:
rrs 2007-06-25 19:05:26 +00:00
parent cb9da230d9
commit a6df17b326

View File

@ -5831,8 +5831,18 @@ sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp,
if (assoc_id == 0) {
/* add the address */
struct sctp_inpcb *lep;
struct sockaddr_in *lsin = (struct sockaddr_in *)addr_touse;
/* validate the incoming port */
if ((lsin->sin_port != 0) &&
(lsin->sin_port != inp->sctp_lport)) {
*error = EINVAL;
return;
} else {
/* user specified 0 port, set it to existing port */
lsin->sin_port = inp->sctp_lport;
}
((struct sockaddr_in *)addr_touse)->sin_port = inp->sctp_lport;
lep = sctp_pcb_findep(addr_touse, 1, 0, vrf_id);
if (lep != NULL) {
/*