summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPaul Richards <paul@FreeBSD.org>2000-05-02 23:53:46 +0000
committerPaul Richards <paul@FreeBSD.org>2000-05-02 23:53:46 +0000
commit7a04c4f85afe65e54fd66a07ea52f712fd2cb8ed (patch)
treec7747f138faefdb4c10d2edb9e44fb271e7a6b8e /sys
parent6ddf2502fe03edf7ad0eabf10903e731d56ca2fa (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_divert.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 6506c8ec1970..bbe50361111b 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -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;
}