Bug 278265 - `route -n monitor' is quiet when redirecting its output
Summary: `route -n monitor' is quiet when redirecting its output
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-STABLE
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-08 19:41 UTC by Oleg Streejak
Modified: 2024-04-09 13:32 UTC (History)
0 users

See Also:


Attachments
adds stdout flush to generic output function (282 bytes, text/plain)
2024-04-09 13:32 UTC, Oleg Streejak
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Streejak 2024-04-08 19:41:55 UTC
Hello

It seems to me that this is an error at /sbin/route

This works fine

[qemu] ~ $ route -n monitor &
[1] 1526
[qemu] ~ $ arp -d 10.0.2.2 ; ifconfig gif0 create ; ifconfig gif0 destroy
10.0.2.2 (10.0.2.2) deleted
22:26:45.838 PID 1527 delete neigh 10.0.2.2 state REACHABLE lladdr 52:55:0a:00:02:02 iface em0 
22:26:45.839 PID    0 add/repl neigh 10.0.2.2 state REACHABLE lladdr 52:55:0a:00:02:02 iface em0 
22:26:45.840 PID    0 add/repl iface iface#3 gif0 admin DOWN oper DOWN mtu 1280 
22:26:45.843 PID    0 add/repl iface iface#3 gif0 admin DOWN oper DOWN mtu 1280 
22:26:45.843 PID    0 add/repl iface iface#3 gif0 admin DOWN oper DOWN mtu 1280 
22:26:45.843 PID    0 add/repl iface iface#3 gif0 admin DOWN oper DOWN mtu 1280 
22:26:45.845 PID    0 delete iface iface#3 gif0 admin DOWN oper DOWN mtu 1280 

but

[qemu] ~ $ route -n monitor > temp.log &
[1] 1535
[qemu] ~ $ arp -d 10.0.2.2 ; ifconfig gif0 create ; ifconfig gif0 destroy
10.0.2.2 (10.0.2.2) deleted
[qemu] ~ $ ll temp.log 
-rw-r--r--  1 root wheel 0 Apr  8 22:26 temp.log

file is zero length, there's no output from `route -n monitor' if we redirect it to file (or pipe within the script)

that's seems to be related w/ 14.0-RELEASE when monitor_nl() and NETLINK is used by default as there's no such behaviour in 13.3-RELEASE

I've tested it on amd64 GENERIC (under qemu and on real hardware servers). Found it while trying to fix wireguard wg-quick tool (see bug #275026)
Comment 1 Oleg Streejak 2024-04-09 13:32:16 UTC
Created attachment 249853 [details]
adds stdout flush to generic output function

the proposed patch. I've compiled and tested route - now it works as expected