From owner-freebsd-net@FreeBSD.ORG Wed Nov 25 18:22:12 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CC73106566C for ; Wed, 25 Nov 2009 18:22:12 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp2.dlr.de (smtp1.dlr.de [129.247.252.32]) by mx1.freebsd.org (Postfix) with ESMTP id C688B8FC18 for ; Wed, 25 Nov 2009 18:22:11 +0000 (UTC) Received: from exbe5.intra.dlr.de ([172.21.106.15]) by smtp2.dlr.de with Microsoft SMTPSVC(6.0.3790.3959); Wed, 25 Nov 2009 19:22:10 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Wed, 25 Nov 2009 19:22:09 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Getting creation and modification time of an IPv6 interface address Thread-Index: Acpt/DNHbSdszT9pRTyVTKm6DQj8aw== From: To: X-OriginalArrivalTime: 25 Nov 2009 18:22:10.0009 (UTC) FILETIME=[33B3D490:01CA6DFC] Subject: Getting creation and modification time of an IPv6 interface address X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 18:22:12 -0000 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 */