Discussion:
PR 35897 - absurd IPv6 config ioctl
(too old to reply)
Robert Elz
2007-08-31 15:20:08 UTC
Permalink
Could someone take a look at PR kern/35897 and perhaps do something
about it?

There is (and has been since the KAME code was added) an ioctl that
cannot possibly (I believe) work. It should be deleted (it clearly
isn't actually used, and when I submitted the PR I did a complete search of
all the NetBSD sources to check that nothing was attempting to use it.)

It really would be nice to have this cleaned up and pulled up to NetBSD 4
before that gets released (the PR has been languishing for 6 months now).

kre


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Greg Troxel
2007-08-31 15:42:24 UTC
Permalink
I believe that you are correct that this is completely broken.

Does this diff look ok? I'll commit in a week or so if there are no
objections.

Index: sys/netinet6/in6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/in6.c,v
retrieving revision 1.131
diff -u -p -r1.131 in6.c
--- sys/netinet6/in6.c 19 Jul 2007 20:48:56 -0000 1.131
+++ sys/netinet6/in6.c 31 Aug 2007 15:41:50 -0000
@@ -447,7 +447,6 @@ in6_control1(struct socket *so, u_long c
case SIOCSPFXFLUSH_IN6:
case SIOCSRTRFLUSH_IN6:
case SIOCGIFALIFETIME_IN6:
- case SIOCSIFALIFETIME_IN6:
case SIOCGIFSTAT_IN6:
case SIOCGIFSTAT_ICMP6:
sa6 = &ifr->ifr_addr;
@@ -512,26 +511,6 @@ in6_control1(struct socket *so, u_long c
if (ia == NULL)
return EADDRNOTAVAIL;
break;
- case SIOCSIFALIFETIME_IN6:
- {
- struct in6_addrlifetime *lt;
-
- if (!privileged)
- return EPERM;
- if (ia == NULL)
- return EADDRNOTAVAIL;
- /* sanity for overflow - beware unsigned */
- lt = &ifr->ifr_ifru.ifru_lifetime;
- if (lt->ia6t_vltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_vltime + time_second < time_second) {
- return EINVAL;
- }
- if (lt->ia6t_pltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_pltime + time_second < time_second) {
- return EINVAL;
- }
- break;
- }
}

switch (cmd) {
@@ -620,21 +599,6 @@ in6_control1(struct socket *so, u_long c
}
break;

- case SIOCSIFALIFETIME_IN6:
- ia->ia6_lifetime = ifr->ifr_ifru.ifru_lifetime;
- /* for sanity */
- if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) {
- ia->ia6_lifetime.ia6t_expire =
- time_second + ia->ia6_lifetime.ia6t_vltime;
- } else
- ia->ia6_lifetime.ia6t_expire = 0;
- if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) {
- ia->ia6_lifetime.ia6t_preferred =
- time_second + ia->ia6_lifetime.ia6t_pltime;
- } else
- ia->ia6_lifetime.ia6t_preferred = 0;
- break;
-
case SIOCAIFADDR_IN6:
{
int i;
Index: sys/netinet6/in6_var.h
===================================================================
RCS file: /cvsroot/src/sys/netinet6/in6_var.h,v
retrieving revision 1.52
diff -u -p -r1.52 in6_var.h
--- sys/netinet6/in6_var.h 19 Jul 2007 20:48:56 -0000 1.52
+++ sys/netinet6/in6_var.h 31 Aug 2007 15:41:50 -0000
@@ -419,7 +419,10 @@ struct in6_rrenumreq {
#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)

#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
+#if 0
+/* withdrawn - do not reuse number 82 */
#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
+#endif
#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq)
#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq)

Index: sys/compat/common/uipc_syscalls_43.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/uipc_syscalls_43.c,v
retrieving revision 1.36
diff -u -p -r1.36 uipc_syscalls_43.c
--- sys/compat/common/uipc_syscalls_43.c 20 Aug 2007 19:19:33 -0000 1.36
+++ sys/compat/common/uipc_syscalls_43.c 31 Aug 2007 15:41:50 -0000
@@ -454,7 +454,6 @@ compat_cvtcmd(u_long cmd)
case SIOCSDEFIFACE_IN6:
case SIOCSIFADDR:
case SIOCSIFADDR_IN6:
- case SIOCSIFALIFETIME_IN6:
case SIOCSIFBRDADDR:
case SIOCSIFDSTADDR:
case SIOCSIFDSTADDR_IN6:

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Robert Elz
2007-08-31 20:42:37 UTC
Permalink
Date: Fri, 31 Aug 2007 11:42:24 -0400
From: Greg Troxel <***@ir.bbn.com>
Message-ID: <***@fnord.ir.bbn.com>

| Does this diff look ok? I'll commit in a week or so if there are no
| objections.

It looks OK to me.

kre

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...