Bug 255495 - udp socket inheritance after fork+exec
Summary: udp socket inheritance after fork+exec
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-29 17:57 UTC by Eugene Grosbein
Modified: 2021-04-30 03:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer 2021-04-29 17:57:50 UTC
I observe the following unexpected behaviour while running both net/frr7 and net/mpd5 within same 12.2-STABLE/amd64 system. After boot, it runs just fine:

# sockstat | fgrep frr
frr      staticd    37908 6  dgram  -> /var/run/logpriv
frr      staticd    37908 10 stream -> /var/run/frr/zserv.api
frr      staticd    37908 11 stream /var/run/frr/staticd.vty
frr      ospfd      37903 6  dgram  -> /var/run/logpriv
frr      ospfd      37903 10 stream -> /var/run/frr/zserv.api
frr      ospfd      37903 11 stream /var/run/frr/ospfd.vty
frr      zebra      37898 6  dgram  -> /var/run/logpriv
frr      zebra      37898 18 stream /var/run/frr/zserv.api
frr      zebra      37898 21 stream /var/run/frr/zebra.vty
frr      zebra      37898 23 stream /var/run/frr/zserv.api
frr      zebra      37898 28 stream /var/run/frr/zserv.api

# sockstat | fgrep mpd5 | fgrep udp4
root     mpd5       26675 26 udp4   *:1701                *:*

That is, mpd5 expects incoming L2TP connections at port udp/1701 and frr7 daemon do not use any UDP sockets, as configured.

The mpd5 daemon has ip-down/ip-up scripts that may do "service frr stop" and "service frr start" in come cases, so frr7 daemons may be started as grandchildren of mpd5 process. After that, I observe this:

# sockstat | fgrep frr
frr      staticd    40712 6  dgram  -> /var/run/logpriv
frr      staticd    40712 12 stream -> /var/run/frr/zserv.api
frr      staticd    40712 13 stream /var/run/frr/staticd.vty
frr      staticd    40712 26 udp4   *:1701                *:*
frr      ospfd      40707 6  dgram  -> /var/run/logpriv
frr      ospfd      40707 12 stream -> /var/run/frr/zserv.api
frr      ospfd      40707 13 stream /var/run/frr/ospfd.vty
frr      ospfd      40707 26 udp4   *:1701                *:*
frr      zebra      40702 6  dgram  -> /var/run/logpriv
frr      zebra      40702 24 stream /var/run/frr/zserv.api
frr      zebra      40702 25 stream /var/run/frr/zebra.vty
frr      zebra      40702 26 udp4   *:1701                *:*
frr      zebra      40702 30 stream /var/run/frr/zserv.api
frr      zebra      40702 35 stream /var/run/frr/zserv.api

frr daemons somehow inherit udp4/1501 socket and that is bad for local L2TP service, it is broken now.
Comment 1 Eugene Grosbein freebsd_committer 2021-04-29 18:40:56 UTC
Sorry for noise, the problem is not in FreeBSD kernel but in the net/mpd5 daemon itself.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2021-04-30 03:37:56 UTC
^Triage: Assign to committer that resolved. Correct resolution