Bug 1250921 - Packet sending fails on short write in sendmsg()
Summary: Packet sending fails on short write in sendmsg()
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: bind
Version: 7.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Petr Menšík
QA Contact: qe-baseos-daemons
: 1250923 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2015-08-06 10:07 UTC by Andreas Schneider
Modified: 2017-05-29 12:33 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-05-29 12:33:53 UTC

Attachments (Terms of Use)

Description Andreas Schneider 2015-08-06 10:07:55 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) {
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
*** Bug 1250923 has been marked as a duplicate of this bug. ***

Comment 3 Martin Sehnoutka 2016-04-21 14:35:29 UTC
Please add steps to reproduce, so I can debug this problem.

Comment 5 Andreas Schneider 2017-05-29 12:33:53 UTC
We will stop using nsupdate in future.

Note You need to log in before you can comment on or make changes to this bug.