Is it possible to trace the routing socket messages going from the kernel to a particular daemon

Robert Watson rwatson at FreeBSD.org
Thu Aug 17 19:05:23 UTC 2006


On Thu, 17 Aug 2006, Shriek wrote:

> Is it possible that we can add some loadable module into the kernel to get a 
> pid of a daemon-process and then somehow trace routing socket messages 
> coming in / going out from the kernel to that particular daemon ? The thing 
> why I am in need of this is that there are two daemons , one daemon is 
> responsible for configuring the interfaces ...and the second is actually 
> awaiting the updates from the kernel ( that it should send in case it sees 
> that there is a change in the ifstate for the interface ---IFD update) ... 
> any resources / material would be of great help.Thanks and regards.

This won't give you exactly what you want, but if you don't know about it 
already, you probably will find it useful.  "route monitor" monitors routing 
socket messages generated by the kernel, and includes the pid of the process 
they are destined for.  It doesn't include messages sent to the kernel.  As an 
exampl:

TTY 1:

peppercorn# route monitor

got message of size 200 on Thu Aug 17 20:03:20 2006
RTM_GET: Report Metrics: len 200, pid: 784, seq 1, errno 0, 
flags:<UP,GATEWAY,DONE,STATIC>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
  default 192.168.100.1 default fxp0:0.3.47.d3.46.47 192.168.100.198

TTY 2 after running route monitor on the first tty:

peppercorn:~> route -n get www.watson.org
    route to: 209.31.154.41
destination: default
        mask: default
     gateway: 192.168.100.1
   interface: fxp0
       flags: <UP,GATEWAY,DONE,STATIC>
  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu 
expire
        0         0         0         0         0         0      1500         0



More information about the freebsd-hackers mailing list