netstat output changes in 8.0?
Nick Rogers
ncrogers at gmail.com
Tue Jan 26 16:49:11 UTC 2010
Thanks a lot. Thats a bummer. What are the chances of getting something like
that worked into arp(8) permanently?
On Tue, Jan 26, 2010 at 4:41 AM, Ruslan Ermilov <ru at freebsd.org> wrote:
> On Mon, Jan 25, 2010 at 07:01:46PM -0800, Nick Rogers wrote:
> > Before 8.0-RELEASE, if I ran netstat -rn, it listed a separate route for
> > each host on the network, along with its MAC address. For example ...
> >
> > 172.20.172.17 00:02:b3:2f:64:6a UHLW 1 105712 1500
> > vlan172 595
> > 172.20.172.20 00:1e:c9:bb:7c:a9 UHLW 1 1002 1500
> > vlan172 598
> > 172.20.172.22 00:14:5e:16:bb:b6 UHLW 1 107 1500
> > vlan172 491
> >
> > This behavior seems to have changed in 8.0, where now only the
> > locally-assigned IP addresses and related CIDRs are displayed.
>
> From src/UPDATING:
>
> : 20081214:
> : __FreeBSD_version 800059 incorporates the new arp-v2 rewrite.
> : RTF_CLONING, RTF_LLINFO and RTF_WASCLONED flags are eliminated.
> : The new code reduced struct rtentry{} by 16 bytes on 32-bit
> : architecture and 40 bytes on 64-bit architecture. The userland
> : applications "arp" and "ndp" have been updated accordingly.
> : The output from "netstat -r" shows only routing entries and
> : none of the L2 information.
>
> > Is there any way to get this behavior back, perhaps with a new flag that
> I
> > am not able to find? Or some sysctl? I have a script that was relying on
> > each host's "expire" flag in the routing table to determine when the MAC
> > address first appeared on the network according to ARP.
>
> If you need to know when a particular ARP entry expires, a variation
> of the following patch can be used, perhaps hiding this output by the
> -v (verbose) option.
>
> %%%
> Index: arp.c
> ===================================================================
> --- arp.c (revision 203016)
> +++ arp.c (working copy)
> @@ -101,7 +101,8 @@
> static int nflag; /* no reverse dns lookups */
> static char *rifname;
>
> -static int expire_time, flags, doing_proxy, proxy_only;
> +static time_t expire_time;
> +static int flags, doing_proxy, proxy_only;
>
> /* which function we're supposed to do */
> #define F_GET 1
> @@ -594,6 +595,15 @@
> printf(" on %s", ifname);
> if (rtm->rtm_rmx.rmx_expire == 0)
> printf(" permanent");
> + else {
> + static struct timeval tv;
> + if (tv.tv_sec == 0)
> + gettimeofday(&tv, 0);
> + if ((expire_time = rtm->rtm_rmx.rmx_expire - tv.tv_sec) >
> 0)
> + printf(" expires %d", (int)expire_time);
> + else
> + printf(" expired");
> + }
> if (addr->sin_other & SIN_PROXY)
> printf(" published (proxy only)");
> if (rtm->rtm_flags & RTF_ANNOUNCE)
> %%%
>
>
> Cheers,
> --
> Ruslan Ermilov
> ru at FreeBSD.org
> FreeBSD committer
>
More information about the freebsd-stable
mailing list