Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2023 14:03:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 272818] hv_kvp_daemon high CPU usage on Internet router
Message-ID:  <bug-272818-227-jHkVVf0deF@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-272818-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-272818-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272818

--- Comment #4 from Greg Becker <greg@codeconcepts.com> ---
Thanks Wencey, that's exactly what I wanted to see, which invalidates all my
original presumptions.

So, now presuming that there are contexts in which these hv_kvp_daemon scri=
pts
run where there is a default route, then the pipeline should return that ro=
ute.=20

So I deleted the default route on one of my machines to see what 'route -n =
get
default' (thanks Yuri!) would return, and curiously it prints a "No error: =
0"
error message to stderr and exits zero.  However, my new awk command should
give the same error as from the grep in the original pipeline when there is=
 no
default route.


root@sm1:~ # route delete default
delete net default

root@sm1:~ # route -n get default
route: route has not been found: No error: 0
root@sm1:~ # echo $?
0

root@sm1:~ # route -n get default | awk -v ifce=3Dix0 '$1 ~ /gateway:/ || (=
$1 ~
/interface:/ && $2 =3D=3D ifce) {val[n++] =3D $2} END{ if (n =3D=3D 2) prin=
t val[0]; exit
(n !=3D 2)}'
route: route has not been found: No error: 0
root@sm1:~ # echo $?
1


And after I restore my default route it seems to do the right thing:

root@sm1:~ # route add default 172.16.1.1
root@sm1:~ # route -n get default | awk -v ifce=3Dix0 '$1 ~ /gateway:/ || (=
$1 ~
/interface:/ && $2 =3D=3D
ifce) {val[n++] =3D $2} END{ if (n =3D=3D 2) print val[0]; exit (n !=3D 2)}'
172.16.1.1

root@sm1:~ # echo $?
0


So, it appears to me that the following pipeline would work.  Is there any =
way
you can test this out?  Presumably the interface is a positional parameter =
to
the script, so you'd need to replace the "ix0" in my awk command with somet=
hing
like ifce=3D"$1" or whatever...  Note that this also presumes the output of
'route -n get default' is fairly rigid.


route -n get default | awk -v ifce=3Dix0 '$1 ~ /gateway:/ || ($1 ~ /interfa=
ce:/
&& $2 =3D=3D ifce) {val[n++] =3D $2} END{ if (n =3D=3D 2) print val[0]; exi=
t (n !=3D 2)}'


I'm not the hp_kvp_daemon maintainer, so I wont speculate as to why they are
doing this directly via route(4).

Hope this helps!
Greg

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272818-227-jHkVVf0deF>