Re: teach fstat about pfkey

2019-01-20 Thread Claudio Jeker
On Mon, Jan 21, 2019 at 01:13:23PM +1000, David Gwynne wrote:
> i was trying to figure out which bit of ldpd had the pfkey socket (cos
> reading code is hard sometimes), but had to work a little bit too hard
> to figure it out from what fstat currently prints. this has fstat printf
> "pfkey" when it hits an AF_KEY socket, rather than hit the default
> handler which prints "30 raw 2 0x0".
> 
> ok?
> 
> Index: fstat.c
> ===
> RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
> retrieving revision 1.95
> diff -u -p -r1.95 fstat.c
> --- fstat.c   16 Sep 2018 02:44:06 -  1.95
> +++ fstat.c   21 Jan 2019 03:11:13 -
> @@ -788,6 +788,10 @@ socktrans(struct kinfo_file *kf)
>   printf(" %d ", kf->so_protocol);
>   hide((void *)(uintptr_t)kf->f_data);
>   break;
> + case AF_KEY:
> + printf("* pfkey");

Can you make this
printf("* pfkey %s", stype);
printf(" %d ", kf->so_protocol);
At least then it is consistent with route.

> + hide((void *)(uintptr_t)kf->f_data);
> + break;
>   default:
>   /* print protocol number and socket address */
>   printf("* %d %s", kf->so_family, stype);
> 

-- 
:wq Claudio



teach fstat about pfkey

2019-01-20 Thread David Gwynne
i was trying to figure out which bit of ldpd had the pfkey socket (cos
reading code is hard sometimes), but had to work a little bit too hard
to figure it out from what fstat currently prints. this has fstat printf
"pfkey" when it hits an AF_KEY socket, rather than hit the default
handler which prints "30 raw 2 0x0".

ok?

Index: fstat.c
===
RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
retrieving revision 1.95
diff -u -p -r1.95 fstat.c
--- fstat.c 16 Sep 2018 02:44:06 -  1.95
+++ fstat.c 21 Jan 2019 03:11:13 -
@@ -788,6 +788,10 @@ socktrans(struct kinfo_file *kf)
printf(" %d ", kf->so_protocol);
hide((void *)(uintptr_t)kf->f_data);
break;
+   case AF_KEY:
+   printf("* pfkey");
+   hide((void *)(uintptr_t)kf->f_data);
+   break;
default:
/* print protocol number and socket address */
printf("* %d %s", kf->so_family, stype);