bin/160295: ypserv -P [bin/109494] breaks tcp

Dylan Simon dylan at dylex.net
Mon Aug 29 19:30:16 UTC 2011


>Number:         160295
>Category:       bin
>Synopsis:       ypserv -P [bin/109494] breaks tcp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 29 19:30:15 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dylan Simon
>Release:        7.4
>Organization:
NYU
>Environment:
FreeBSD lust.cns.nyu.edu 7.4-RELEASE-p2 FreeBSD 7.4-RELEASE-p2 #14: Sun Jul 24 18:28:27 EDT 2011     dylan at lust.cns.nyu.edu:/usr/obj/usr/src/sys/SIN  amd64
>Description:
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'
>How-To-Repeat:
Run ypserv -P <port>
Perform TCP NIS request from client
>Fix:
Use a different variable for each socket.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list