mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
Force the address of the socket to be INADDR_ANY immediately before
calling in_pcbbind so that in_pcbbind sees a valid address if no address was specified (since divert sockets ignore them). PR: 17552 Reviewed by: Brian
This commit is contained in:
parent
6ddf2502fe
commit
7a04c4f85a
1 changed files with 13 additions and 1 deletions
|
|
@ -406,7 +406,19 @@ div_bind(struct socket *so, struct sockaddr *nam, struct proc *p)
|
|||
|
||||
s = splnet();
|
||||
inp = sotoinpcb(so);
|
||||
error = in_pcbbind(inp, nam, p);
|
||||
/* in_pcbbind assumes that the socket is a sockaddr_in
|
||||
* and in_pcbbind requires a valid address. Since divert
|
||||
* sockets don't we need to make sure the address is
|
||||
* filled in properly.
|
||||
* XXX -- divert should not be abusing in_pcbind
|
||||
* and should probably have its own family.
|
||||
*/
|
||||
if (nam->sa_family != AF_INET) {
|
||||
error = EAFNOSUPPORT;
|
||||
} else {
|
||||
((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY;
|
||||
error = in_pcbbind(inp, nam, p);
|
||||
}
|
||||
splx(s);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue