Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

net-online service fails because nc can't send broadcast packet #1526

Open
asomers opened this issue Feb 3, 2018 · 1 comment
Open

net-online service fails because nc can't send broadcast packet #1526

asomers opened this issue Feb 3, 2018 · 1 comment

Comments

@asomers
Copy link

asomers commented Feb 3, 2018

The net-online script tries to detect when a network interface is up by sending a packet to a broadcast address. It doesn't wait for a reply. If sending succeeds, then it concludes that a network interface is ready. After the latest upgrade, this no longer works. Despite my network interface being up and having the broadcast flag set, nc fails to send the packet. It gets EACCESS, and I don't know why. The same operation succeeds on FreeBSD head.

> ktrace nc -uz 255.255.255.255 111
> kdump
...
  8008 nc       CALL  socket(PF_INET,0x20000002<SOCK_DGRAM|SOCK_NONBLOCK>,IPPROTO_UDP)
  8008 nc       RET   socket 3
  8008 nc       CALL  connect(0x3,0x800ebb070,0x10)
  8008 nc       STRU  struct sockaddr { AF_INET, 255.255.255.255:111 }
  8008 nc       RET   connect 0
  8008 nc       CALL  write(0x3,0x2005ca,0x1)
  8008 nc       RET   write -1 errno 13 Permission denied
  8008 nc       CALL  write(0x3,0x2005ca,0x1)
  8008 nc       RET   write -1 errno 13 Permission denied
  8008 nc       CALL  write(0x3,0x2005ca,0x1)
  8008 nc       RET   write -1 errno 13 Permission denied
  8008 nc       CALL  write(0x3,0x2005ca,0x1)
  8008 nc       RET   write -1 errno 13 Permission denied
...
> about

===================
General information
===================

boot environment now (N) … 12.0-CURRENT-up-20180130_230727 NR 2018-01-30
       after restart (R) … 12.0-CURRENT-up-20180130_230727 NR 2018-01-30
boot loader …………………………………… BSD
            type ……………………… EFI
CPU ………………………………………………………… Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
    number of cores ……………… 8
host ……………………………………………………… threonine.lauralan.noip.me
memory ………………………………………………… 16384 MB available, 13192 MB free
OS git branch ……………………………………………………………………………………… trueos-master
OS git revision ………………………………………………………………………………… ae187cb00
OS kernel build time ………………………………………………………… Fri 2018 Jan 26 21:09:38 UTC
OS kernel identity …………………………………………… (uname -i) GENERIC
OS platform (architecture) ……………………… (uname -m) amd64
OS release level ………………………………………………… (uname -r) 12.0-CURRENT
OS version and patch level …… (freebsd-version) 12.0-CURRENT
TrueOS package set ………………… EDGE
TrueOS version …………………………… TrueOS-Desktop-201712150936
uptime ………………………………………………… 7 mins
user  …………………………………………………… somers

More (TrueOS Desktop):

    desktop environment …… Lumina
    sound card driver ………… pcm0: <NVIDIA (0x0072) (HDMI/DP 8ch)> (play) default
    wireless driver ……………… 
    X11 drivers ………………………… nvidia_drv.so
@rostwald
Copy link
Contributor

rostwald commented May 8, 2018

I've encountered similar problems when using the net-online script with 18.03 release (to get ypbind/ypset working again).
Sending to any other (broadcast) IP than 255.255.255.255 succeeds as soon as an interface is up.

I can reproduce this behaviour with the same netcat version (1.10_3) on 11.1-RELEASE-p6, but on 11.1-RELEASE-p1 it succeeds, so I suspect this regression was introduced within the timeframe between p1 and p6.

Quick workaround: using e.g. 0.0.0.255 for the broadcast will work as intended for the net-online script.

Edit:
The net-online script has been removed in 18.03 anyways. I still have some patches for ypset and ypbind init scripts sitting here I need to clean up and test with a fresh/vanilla installation, but basically I've transferred the check that was done by net-online to these init scritps so NIS keeps working regardless if the net-online pseudoservice stays removed or being modified and gets broken again sometime.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants