Public bug reported:

OS: Ubuntu Xenial Ubuntu 16.04.5 LTS
Package: netcat-openbsd 1.105-7ubuntu1

I want to send broadcasts over the loopback device:

$ nc -vu 127.255.255.255 1024
nc: connect to 127.255.255.255 port 1024 (udp) failed: Permission denied

This does not work since the broadcast socket option hasn't been enabled
which is also correct. So I retry with:

$ nc -vbu 127.255.255.255 1024
nc: Protocol not available

This is strange. Doing an strace reveals the reason:

$ strace nc -u 127.255.255.255 1024
...
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
connect(3, {sa_family=AF_INET, sin_port=htons(1024), 
sin_addr=inet_addr("127.255.255.255")}, 16) = -1 EACCES (Permission denied)
fcntl(3, F_SETFL, O_RDWR)               = 0
close(3)                                = 0
close(-1)                               = -1 EBADF (Bad file descriptor)
exit_group(1)                           = ?
+++ exited with 1 +++

Okay, but now with "b":

$ strace nc -bu 127.255.255.255 1024
...
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
setsockopt(3, SOL_TCP, TCP_KEEPCNT, [1], 4) = -1 ENOPROTOOPT (Protocol not 
available)
write(2, "nc: ", 4nc: )                     = 4
write(2, "Protocol not available\n", 23Protocol not available
) = 23
exit_group(1)                           = ?
+++ exited with 1 +++

This is very amazing: why does a TCP socket option get set when I am requesting 
the broadcast mode? I have analysed the original Debian package where the 
broadcast option gets added (the original OpenBSD package misses it), but the 
respective integration patch seems correct to me 
(0010-misc-failures-and-features.patch).
Package page: https://packages.debian.org/stretch/netcat-openbsd

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: netcat-openbsd 1.105-7ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-30.32~16.04.1-generic 4.15.18
Uname: Linux 4.15.0-30-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.18
Architecture: amd64
CurrentDesktop: X-Cinnamon
Date: Mon Aug 13 11:31:28 2018
Dependencies:
 gcc-7-base 7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
 libbsd0 0.8.2-1
 libc6 2.23-0ubuntu10
 libgcc1 1:7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
EcryptfsInUse: Yes
SourcePackage: netcat-openbsd
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: netcat-openbsd (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug third-party-packages xenial

** Description changed:

  OS: Ubuntu Xenial Ubuntu 16.04.5 LTS
  Package: netcat-openbsd 1.105-7ubuntu1
  
  I want to send broadcasts over the loopback device:
  
  $ nc -vu 127.255.255.255 1024
  nc: connect to 127.255.255.255 port 1024 (udp) failed: Permission denied
  
  This does not work since the broadcast socket option hasn't been enabled
  which is also correct. So I retry with:
  
  $ nc -vbu 127.255.255.255 1024
  nc: Protocol not available
  
  This is strange. Doing an strace reveals the reason:
  
  $ strace nc -u 127.255.255.255 1024
  ...
  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
  fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
  fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
  connect(3, {sa_family=AF_INET, sin_port=htons(1024), 
sin_addr=inet_addr("127.255.255.255")}, 16) = -1 EACCES (Permission denied)
  fcntl(3, F_SETFL, O_RDWR)               = 0
  close(3)                                = 0
  close(-1)                               = -1 EBADF (Bad file descriptor)
  exit_group(1)                           = ?
  +++ exited with 1 +++
  
  Okay, but now with "b":
  
  $ strace nc -bu 127.255.255.255 1024
  ...
  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
  setsockopt(3, SOL_TCP, TCP_KEEPCNT, [1], 4) = -1 ENOPROTOOPT (Protocol not 
available)
  write(2, "nc: ", 4nc: )                     = 4
  write(2, "Protocol not available\n", 23Protocol not available
  ) = 23
  exit_group(1)                           = ?
  +++ exited with 1 +++
  
- This is very amazing: why does a TCP socket option get set when I am
- requesting the broadcast mode? I have analysed the original Debian
- package where the broadcast option gets added (in the original OpenBSD
- package it is not existing), but the respective integration patch seems
- correct to me (0010-misc-failures-and-features.patch). Package page:
- https://packages.debian.org/stretch/netcat-openbsd
+ This is very amazing: why does a TCP socket option get set when I am 
requesting the broadcast mode? I have analysed the original Debian package 
where the broadcast option gets added (the original OpenBSD package misses it), 
but the respective integration patch seems correct to me 
(0010-misc-failures-and-features.patch).
+ Package page: https://packages.debian.org/stretch/netcat-openbsd
  
  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: netcat-openbsd 1.105-7ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-30.32~16.04.1-generic 4.15.18
  Uname: Linux 4.15.0-30-generic x86_64
  ApportVersion: 2.20.1-0ubuntu2.18
  Architecture: amd64
  CurrentDesktop: X-Cinnamon
  Date: Mon Aug 13 11:31:28 2018
  Dependencies:
-  gcc-7-base 7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
-  libbsd0 0.8.2-1
-  libc6 2.23-0ubuntu10
-  libgcc1 1:7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
+  gcc-7-base 7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
+  libbsd0 0.8.2-1
+  libc6 2.23-0ubuntu10
+  libgcc1 1:7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
  EcryptfsInUse: Yes
  SourcePackage: netcat-openbsd
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to netcat-openbsd in Ubuntu.
https://bugs.launchpad.net/bugs/1786756

Title:
  netcat-openbsd broadcast not working

Status in netcat-openbsd package in Ubuntu:
  New

Bug description:
  OS: Ubuntu Xenial Ubuntu 16.04.5 LTS
  Package: netcat-openbsd 1.105-7ubuntu1

  I want to send broadcasts over the loopback device:

  $ nc -vu 127.255.255.255 1024
  nc: connect to 127.255.255.255 port 1024 (udp) failed: Permission denied

  This does not work since the broadcast socket option hasn't been
  enabled which is also correct. So I retry with:

  $ nc -vbu 127.255.255.255 1024
  nc: Protocol not available

  This is strange. Doing an strace reveals the reason:

  $ strace nc -u 127.255.255.255 1024
  ...
  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
  fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
  fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
  connect(3, {sa_family=AF_INET, sin_port=htons(1024), 
sin_addr=inet_addr("127.255.255.255")}, 16) = -1 EACCES (Permission denied)
  fcntl(3, F_SETFL, O_RDWR)               = 0
  close(3)                                = 0
  close(-1)                               = -1 EBADF (Bad file descriptor)
  exit_group(1)                           = ?
  +++ exited with 1 +++

  Okay, but now with "b":

  $ strace nc -bu 127.255.255.255 1024
  ...
  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
  setsockopt(3, SOL_TCP, TCP_KEEPCNT, [1], 4) = -1 ENOPROTOOPT (Protocol not 
available)
  write(2, "nc: ", 4nc: )                     = 4
  write(2, "Protocol not available\n", 23Protocol not available
  ) = 23
  exit_group(1)                           = ?
  +++ exited with 1 +++

  This is very amazing: why does a TCP socket option get set when I am 
requesting the broadcast mode? I have analysed the original Debian package 
where the broadcast option gets added (the original OpenBSD package misses it), 
but the respective integration patch seems correct to me 
(0010-misc-failures-and-features.patch).
  Package page: https://packages.debian.org/stretch/netcat-openbsd

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: netcat-openbsd 1.105-7ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-30.32~16.04.1-generic 4.15.18
  Uname: Linux 4.15.0-30-generic x86_64
  ApportVersion: 2.20.1-0ubuntu2.18
  Architecture: amd64
  CurrentDesktop: X-Cinnamon
  Date: Mon Aug 13 11:31:28 2018
  Dependencies:
   gcc-7-base 7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
   libbsd0 0.8.2-1
   libc6 2.23-0ubuntu10
   libgcc1 1:7.2.0-8ubuntu3.2 [origin: TUXEDO Computers]
  EcryptfsInUse: Yes
  SourcePackage: netcat-openbsd
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/1786756/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to