summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-05-31 19:16:53 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-05-31 19:16:53 +0000
commitad7b44d397835c1db78fd0e2503e49b5c856ccfc (patch)
treed906f608b282574517b6003d3fee39827bc25ec0 /sys
parent167475d2342ef87069fb78ddf8841e0337e52eca (diff)
Remove the scrub argument from in_ifinit() and simply call in_ifscrub()
unconditionally for SIOCSIFADDR. ok bluhm@, henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pppx.c4
-rw-r--r--sys/net/if_spppsubr.c11
-rw-r--r--sys/netinet/in.c17
-rw-r--r--sys/netinet/in_var.h4
4 files changed, 12 insertions, 24 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 836a6b2b8f9..9e27a5bd48b 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.18 2013/04/10 01:35:55 guenther Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.19 2013/05/31 19:16:52 mpi Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -915,7 +915,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr;
- error = in_ifinit(ifp, ia, &ifaddr, 0, 1);
+ error = in_ifinit(ifp, ia, &ifaddr, 1);
if (error) {
printf("pppx: unable to set addresses for %s, error=%d\n",
ifp->if_xname, error);
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 12a6bf8b5c3..a435b58daaa 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.101 2013/03/28 16:55:27 deraadt Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.102 2013/05/31 19:16:52 mpi Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
* Keepalive protocol implemented in both Cisco and PPP modes.
@@ -4739,11 +4739,6 @@ sppp_set_ip_addrs(void *arg1, void *arg2)
struct sockaddr_in new_sin = *si;
struct sockaddr_in new_dst = *dest;
- /*
- * Scrub old routes now instead of calling in_ifinit with
- * scrub=1, because we may change the dstaddr
- * before the call to in_ifinit.
- */
in_ifscrub(ifp, ifatoia(ifa));
if (myaddr != 0)
@@ -4755,7 +4750,7 @@ sppp_set_ip_addrs(void *arg1, void *arg2)
*dest = new_dst; /* fix dstaddr in place */
}
}
- if (!(error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 0, 0)))
+ if (!(error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 0)))
dohooks(ifp->if_addrhooks, 0);
if (debug && error) {
log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addrs: in_ifinit "
@@ -4816,7 +4811,7 @@ sppp_clear_ip_addrs(void *arg1, void *arg2)
if (sp->ipcp.flags & IPCP_HISADDR_DYN)
/* replace peer addr in place */
dest->sin_addr.s_addr = sp->ipcp.saved_hisaddr;
- if (!(error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 0, 0)))
+ if (!(error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 0)))
dohooks(ifp->if_addrhooks, 0);
if (debug && error) {
log(LOG_DEBUG, SPP_FMT "sppp_clear_ip_addrs: in_ifinit "
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index b8f72cd8051..3901a84ed9a 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.76 2013/05/13 10:17:13 mpi Exp $ */
+/* $OpenBSD: in.c,v 1.77 2013/05/31 19:16:52 mpi Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -341,8 +341,8 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
case SIOCSIFADDR:
s = splsoftnet();
- error = in_ifinit(ifp, ia, satosin(&ifr->ifr_addr), 1,
- newifaddr);
+ in_ifscrub(ifp, ia);
+ error = in_ifinit(ifp, ia, satosin(&ifr->ifr_addr), newifaddr);
if (!error)
dohooks(ifp->if_addrhooks, 0);
else if (newifaddr) {
@@ -391,8 +391,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
sintosa(&ifra->ifra_broadaddr));
}
if (ifra->ifra_addr.sin_family == AF_INET && needinit) {
- error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0,
- newifaddr);
+ error = in_ifinit(ifp, ia, &ifra->ifra_addr, newifaddr);
}
if (!error)
dohooks(ifp->if_addrhooks, 0);
@@ -641,7 +640,7 @@ in_ifscrub(struct ifnet *ifp, struct in_ifaddr *ia)
*/
int
in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
- int scrub, int newaddr)
+ int newaddr)
{
u_int32_t i = sin->sin_addr.s_addr;
struct sockaddr_in oldaddr;
@@ -673,12 +672,6 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
*/
splsoftassert(IPL_SOFTNET);
- if (scrub) {
- ia->ia_ifa.ifa_addr = sintosa(&oldaddr);
- in_ifscrub(ifp, ia);
- ia->ia_ifa.ifa_addr = sintosa(&ia->ia_addr);
- }
-
if (ia->ia_netmask == 0) {
if (IN_CLASSA(i))
ia->ia_netmask = IN_CLASSA_NET;
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index a5e0031d836..1af8e80ab84 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.19 2013/03/22 01:41:12 tedu Exp $ */
+/* $OpenBSD: in_var.h,v 1.20 2013/05/31 19:16:52 mpi Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -213,7 +213,7 @@ do { \
} while (/* CONSTCOND */ 0)
int in_ifinit(struct ifnet *,
- struct in_ifaddr *, struct sockaddr_in *, int, int);
+ struct in_ifaddr *, struct sockaddr_in *, int);
struct in_multi *in_addmulti(struct in_addr *, struct ifnet *);
void in_delmulti(struct in_multi *);
void in_ifscrub(struct ifnet *, struct in_ifaddr *);