On Sat, Apr 07, 2018 at 11:51:39AM +0100, Stuart Henderson wrote:
> On 2018/04/07 12:29, Peter J. Philipp wrote:
> > Hi,
> >
> > I've been running iked for a while now and have been able to guess which
> > iked
> > belongs to which rdomain by the cpu counter but as I'm using the other iked
> > more the cpu counter is about the same and it's confusing when I have to
> > restart iked with route exec.
> >
> > I introduce the -r flag to fstat in order to display rdomains on sockets in
> > order to find the right iked. The fix is simple but because some peoples
> > scripts may depend on the old output I made it an extra flag.
>
> If you're just trying to find the pid there's an existing way,
> 'pgrep -T 2 iked'. But I do think it's useful to print this in fstat
> output, especially when a single process uses multiple tables.
>
> How about skipping the -r flag, but printing it after the existing
> "internet [...] addr:port", and only printing if it's a non-default
> table? This should minimise breakage, and it's not like the format
> is cast in stone (spliced sockets were added in the past).
>
> I wonder about using "rtable" instead of "rdomain" in the text, it
> would be more accurate (but then I do see "rdomain" in some other
> programs like bgpd).
>
I agree that this should print rtable. bgpd is a bit special when it comes
to rdomain vs rtable. It uses both but for different contexts (e.g. bgpd
is using an rdomain to do nexthop validation but can update any rtable).
Sockets shown by fstat are always bound to an rtable and therefor should
print rtable and not rdomain. With that change it is OK claudio@
> Index: fstat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
> retrieving revision 1.92
> diff -u -p -r1.92 fstat.c
> --- fstat.c 6 Apr 2018 14:05:06 -0000 1.92
> +++ fstat.c 7 Apr 2018 10:43:56 -0000
> @@ -740,11 +740,15 @@ socktrans(struct kinfo_file *kf)
> printf("* internet %s", stype);
> getinetproto(kf->so_protocol);
> print_inet_details(kf);
> + if (kf->inp_rtableid)
> + printf(" rdomain %u", kf->inp_rtableid);
> break;
> case AF_INET6:
> printf("* internet6 %s", stype);
> getinetproto(kf->so_protocol);
> print_inet6_details(kf);
> + if (kf->inp_rtableid)
> + printf(" rdomain %u", kf->inp_rtableid);
> break;
> case AF_UNIX:
> /* print address of pcb and connected pcb */
>
--
:wq Claudio