Bug 1250923

Summary: Packet sending fails on short write in sendmsg()
Product: Red Hat Enterprise Linux 7 Reporter: Andreas Schneider <asn>
Component: bindAssignee: Tomáš Hozza <thozza>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: asn, jbastian, jhrozek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 12:55:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andreas Schneider 2015-08-06 10:09:05 UTC
Description of problem:

I've tried to get nsupdate working in our Samba test environment. We use a tool called socket_wrapper [1] to build an isolated network. socket_wrapper is a library passing all socket communications through unix sockets.

socket_wrapper limits the max packet size to 1500 bytes to make it easier to write pcap files.

The function doio_send() uses sendmsg() to send the packet over the wire. nsupdate sends the tsig over a TCP connection. The packet size is 1505 bytes. socket_wrapper limits the packet size to 1500 and sends 1500 bytes, which is the return value. doio_send() detects it (see gdb output below) sets a soft error.

doio_send (sock=sock@entry=0x7ffff7f764b0, dev=0x7ffff7ed0678) at socket.c:1866
1866            if (cc < 0) {
(gdb)
1860            cc = sendmsg(sock->fd, &msghdr, 0);
(gdb) p msghdr
$6 = {msg_name = 0x0, msg_namelen = 0, msg_iov = 0x7ffff303ab70, msg_iovlen = 1, msg_control = 0x0, msg_controllen = 0, msg_flags = 0}
(gdb) n
1861            send_errno = errno;
(gdb) n
1866            if (cc < 0) {
(gdb) p cc
$7 = 1500
(gdb) n
1927            if (cc == 0) {
(gdb) n
1939            dev->n += cc;
(gdb) n
1940            if ((size_t)cc != write_count)
(gdb) p write_count
$8 = 1505


doio_send() should call sendmsg() again and just send the remaining bytes!



[1] https://cwrap.org/socket_wrapper.html

Comment 2 Tomáš Hozza 2015-12-07 12:55:23 UTC

*** This bug has been marked as a duplicate of bug 1250921 ***