From e43d5f77c5172d0db6f375787509c0227bb096d7 Mon Sep 17 00:00:00 2001 From: itojun Date: Wed, 22 Mar 2000 03:48:30 +0000 Subject: [PATCH] comment out ifconfig undo code. they are necessary to avoid memory leakage, however, was too strict that they disallow multiple address from same prefix to be assigned (when rtinit returns EEXIST). we'll need to improve it. --- sys/netinet/in.c | 13 ++++++++++++- sys/netinet6/in6.c | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 0f02f4c916a..a18d81295b1 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.16 2000/03/12 06:46:31 itojun Exp $ */ +/* $OpenBSD: in.c,v 1.17 2000/03/22 03:48:30 itojun Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -352,6 +352,14 @@ in_control(so, cmd, data, ifp) case SIOCSIFADDR: error = in_ifinit(ifp, ia, satosin(&ifr->ifr_addr), 1); +#if 0 + /* + * the code chokes if we are to assign multiple addresses with + * the same address prefix (rtinit() will return EEXIST, which + * is not fatal actually). we will get memory leak if we + * don't do it. + * -> we may want to hide EEXIST from rtinit(). + */ undo: if (error && newifaddr){ TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); @@ -360,6 +368,7 @@ in_control(so, cmd, data, ifp) if ((ifp->if_flags & IFF_LOOPBACK) == 0) in_interfaces--; } +#endif return error; case SIOCSIFNETMASK: @@ -394,8 +403,10 @@ in_control(so, cmd, data, ifp) if (ifra->ifra_addr.sin_family == AF_INET && (hostIsNew || maskIsNew)) { error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0); +#if 0 if (error) goto undo; +#endif } if ((ifp->if_flags & IFF_BROADCAST) && (ifra->ifra_broadaddr.sin_family == AF_INET)) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 296eacb83b3..5e1930cb4e9 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,5 +1,5 @@ -/* $OpenBSD: in6.c,v 1.16 2000/03/12 06:16:58 itojun Exp $ */ -/* $KAME: in6.c,v 1.55 2000/02/25 00:32:23 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.17 2000/03/22 03:48:30 itojun Exp $ */ +/* $KAME: in6.c,v 1.63 2000/03/21 05:18:38 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -628,6 +628,14 @@ in6_control(so, cmd, data, ifp, p) case SIOCSIFADDR_IN6: error = in6_ifinit(ifp, ia, &ifr->ifr_addr, 1); +#if 0 + /* + * the code chokes if we are to assign multiple addresses with + * the same address prefix (rtinit() will return EEXIST, which + * is not fatal actually). we will get memory leak if we + * don't do it. + * -> we may want to hide EEXIST from rtinit(). + */ undo: if (error && newifaddr) { TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); @@ -648,6 +656,7 @@ in6_control(so, cmd, data, ifp, p) } IFAFREE(&ia->ia_ifa); } +#endif return error; #ifdef COMPAT_IN6IFIOCTL /* XXX should be unused */ @@ -730,8 +739,10 @@ in6_control(so, cmd, data, ifp, p) } if (hostIsNew || prefixIsNew) { error = in6_ifinit(ifp, ia, &ifra->ifra_addr, 0); +#if 0 if (error) goto undo; +#endif } if (hostIsNew && (ifp->if_flags & IFF_MULTICAST)) { int error_local = 0; -- 2.20.1