Date: Sun, 23 Jun 2019 19:26:15 +0000 From: bugzilla-noreply@freebsd.org To: testing@freebsd.org Subject: [Bug 238781] sys.netinet.socket_afinet.socket_afinet_bind_zero does not work when mac_portacl(4) loaded Message-ID: <bug-238781-32464@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238781 Bug ID: 238781 Summary: sys.netinet.socket_afinet.socket_afinet_bind_zero does not work when mac_portacl(4) loaded Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: tests Assignee: testing@freebsd.org Reporter: lwhsu@FreeBSD.org CC: bz@FreeBSD.org, rwatson@FreeBSD.org sys.netinet.socket_afinet.socket_afinet_bind_zero does not work when mac_portacl(4) loaded, while mac_portacl is needed for tests under /usr/tests/sys/mac/portacl. For this simplified program: #include <sys/errno.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> #include <unistd.h> int main(int argc, const char *argv[]) { int sd, rc; struct sockaddr_in sin; sd =3D socket(PF_INET, SOCK_DGRAM, 0); bzero(&sin, sizeof(sin)); //sin.sin_family =3D AF_INET; rc =3D bind(sd, (struct sockaddr *)&sin, sizeof(sin)); if (rc < 0) { perror("bind failed"); } else { printf("bind ok.\n"); } close(sd); return 0; } When mac_portacl(4) is loaded, it outputs: bind failed: Invalid argument And we found that uncomment line 16, sin.sin_family =3D AF_INET, will make bind(2) work.=20 >From bz: it could be that portacl enforces the error because of the missing sin_fami= ly which we by policy do not enforce for AF_INET (per comment in in_pcb.c [1]). [1] https://svnweb.freebsd.org/base/head/sys/netinet/in_pcb.c?annotate=3D346677= #l816 --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238781-32464>