Date: Wed, 25 Nov 2009 19:22:09 +0100 From: <Hartmut.Brandt@dlr.de> To: <freebsd-net@freebsd.org> Subject: Getting creation and modification time of an IPv6 interface address Message-ID: <E086A96846579E4F932C168218DB1E5502412A@exbe5.intra.dlr.de>
next in thread | raw e-mail | index | archive | help
Hi, I'm working on the IpAddressTable for bsnmpd. This table has two rows = ipAddressCreated and ipAddressLastUpdated which seem to correspond to the created and changed fields of the struct in6_ifaddr. = Because there seems no way (except for poking in the kernel memory) to get at these values I have added an ioctl to get them = much in the spirit of the other ioctls for IPv6 addresses. I'm not sure how the ioctl codes are allocated so I just took the next = available one. If this looks ok and there are no principal problems, I would like to commit that. harti Index: in6.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/cvsup/src/sys/netinet6/in6.c,v retrieving revision 1.121.2.8 diff -u -r1.121.2.8 in6.c --- in6.c 28 Oct 2009 21:45:25 -0000 1.121.2.8 +++ in6.c 25 Nov 2009 17:41:40 -0000 @@ -312,6 +312,7 @@ case SIOCSIFALIFETIME_IN6: case SIOCGIFSTAT_IN6: case SIOCGIFSTAT_ICMP6: + case SIOCGIFATIMES_IN6: sa6 =3D &ifr->ifr_addr; break; default: @@ -383,6 +384,7 @@ case SIOCGIFNETMASK_IN6: case SIOCGIFDSTADDR_IN6: case SIOCGIFALIFETIME_IN6: + case SIOCGIFATIMES_IN6: /* must think again about its semantics */ if (ia =3D=3D NULL) { error =3D EADDRNOTAVAIL; @@ -652,6 +654,11 @@ prelist_remove(pr); EVENTHANDLER_INVOKE(ifaddr_event, ifp); break; + + case SIOCGIFATIMES_IN6: + ifr->ifr_ifru.ifru_times[0] =3D ia->ia6_createtime; + ifr->ifr_ifru.ifru_times[1] =3D ia->ia6_updatetime; + break; } =20 default: Index: in6_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/cvsup/src/sys/netinet6/in6_var.h,v retrieving revision 1.45.2.1 diff -u -r1.45.2.1 in6_var.h --- in6_var.h 3 Aug 2009 08:13:06 -0000 1.45.2.1 +++ in6_var.h 25 Nov 2009 17:07:34 -0000 @@ -277,6 +277,7 @@ struct in6_ifstat ifru_stat; struct icmp6_ifstat ifru_icmp6stat; u_int32_t ifru_scope_id[16]; + time_t ifru_times[2]; } ifr_ifru; }; =20 @@ -463,6 +464,8 @@ #define SIOCAADDRCTL_POLICY _IOW('u', 108, struct in6_addrpolicy) #define SIOCDADDRCTL_POLICY _IOW('u', 109, struct in6_addrpolicy) =20 +#define SIOCGIFATIMES_IN6 _IOWR('i', 110, struct in6_ifreq) + #define IN6_IFF_ANYCAST 0x01 /* anycast address */ #define IN6_IFF_TENTATIVE 0x02 /* tentative address */ #define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E086A96846579E4F932C168218DB1E5502412A>