[Bug 238781] sys.netinet.socket_afinet.socket_afinet_bind_zero does not work when mac_portacl(4) loaded
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Jun 23 19:26:18 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238781
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 at freebsd.org
Reporter: lwhsu at FreeBSD.org
CC: bz at FreeBSD.org, rwatson at 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 = socket(PF_INET, SOCK_DGRAM, 0);
bzero(&sin, sizeof(sin));
//sin.sin_family = AF_INET;
rc = 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 = AF_INET, will make
bind(2) work.
>From bz:
it could be that portacl enforces the error because of the missing sin_family
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=346677#l816
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-testing
mailing list