The -P argument to ypserv breaks NIS over TCP. After starting ypserv -P 666 I see: tcp4 0 0 *.666 *.* CLOSED From the code ( http://svnweb.freebsd.org/base/stable/7/usr.sbin/ypserv/yp_main.c?r1=172506&r2=177753 ) the problem is rather obvious: the sock variable is used for both the udp and tcp sockets, and so while transp = svcudp_create(sock); works fine (after losing the tcp socket), transp = svctcp_create(sock, 0, 0); doesn't work at all on the already open udp socket. Here are the relevant calls. Notice fd 4 is never touched again: socket(PF_INET,SOCK_STREAM,0) = 4 (0x4) bind(4,{ AF_INET 0.0.0.0:666 },16) = 0 (0x0) socket(PF_INET,SOCK_DGRAM,0) = 5 (0x5) bind(5,{ AF_INET 0.0.0.0:666 },16) = 0 (0x0) getsockopt(0x5,0x0,0x13,0x7fffffffe4ec,0x7fffffffe4e0,0x7fffffffe340) = 0 (0x0) setsockopt(0x5,0x0,0x13,0x7fffffffe4e8,0x4,0x7fffffffe458) = 0 (0x0) bind(5,{ AF_INET 0.0.0.0:0 },16) ERR#22 'Invalid argument' setsockopt(0x5,0x0,0x13,0x7fffffffe4ec,0x4,0x7fffffffe458) = 0 (0x0) listen(0x5,0x80,0x13,0x8007dd42c,0xffffff80ec8b4d40,0x7fffffffe458) ERR#45 'Operation not supported' getsockopt(0x5,0x0,0x13,0x7fffffffe4ec,0x7fffffffe4e0,0x800a00728) = 0 (0x0) setsockopt(0x5,0x0,0x13,0x7fffffffe4e8,0x4,0x7fffffffe458) = 0 (0x0) bind(5,{ AF_INET 0.0.0.0:0 },16) ERR#22 'Invalid argument' setsockopt(0x5,0x0,0x13,0x7fffffffe4ec,0x4,0x7fffffffe458) = 0 (0x0) listen(0x5,0x80,0x13,0x8007dd42c,0xffffff80ec8b4d40,0x7fffffffe458) ERR#45 'Operation not supported' Fix: Use a different variable for each socket. How-To-Repeat: Run ypserv -P <port> Perform TCP NIS request from client
Attached is a patch that seems to work. However, there seems to be another bug using ypserv -d where it exits ypproc_all_2_svc at the end even though it hasn't forked (PR #10970 collateral?), so I can't test completely. (I'm trying to get automount maps in linux to pull from FreeBSD NIS, which still isn't working.)
Someone has done a rewrite to this exact section of code without fixing this bug. This bug completely breaks NIS over TCP which completely disables many (non-freebsd) clients. It is serious and blatantly obvious how the code is broken. It has been a year. Please somebody fix it.
Responsible Changed From-To: freebsd-bugs->hrs I'll take this.
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>