Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_spppsubr.c
Show All 39 Lines | |||||
#include <sys/md5.h> | #include <sys/md5.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/netisr.h> | #include <net/netisr.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route/route_ctl.h> | |||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_var.h> | |||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <net/slcompress.h> | #include <net/slcompress.h> | ||||
#include <machine/stdarg.h> | #include <machine/stdarg.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
▲ Show 20 Lines • Show All 4,818 Lines • ▼ Show 20 Lines | if (ifa->ifa_addr->sa_family == AF_INET) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
if (ifa != NULL) { | if (ifa != NULL) { | ||||
int error; | int error; | ||||
int fibnum = ifp->if_fib; | |||||
rt_addrmsg(RTM_DELETE, ifa, fibnum); | |||||
/* delete old route */ | /* delete old route */ | ||||
error = rtinit(ifa, (int)RTM_DELETE, RTF_HOST); | ia = ifatoia(ifa); | ||||
error = in_handle_ifaddr_rtrequest(RTM_DELETE, ia); | |||||
if (debug && error) { | if (debug && error) { | ||||
log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit DEL failed, error=%d\n", | log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit DEL failed, error=%d\n", | ||||
SPP_ARGS(ifp), error); | SPP_ARGS(ifp), error); | ||||
} | } | ||||
/* set new address */ | /* set new address */ | ||||
si->sin_addr.s_addr = htonl(src); | si->sin_addr.s_addr = htonl(src); | ||||
ia = ifatoia(ifa); | |||||
IN_IFADDR_WLOCK(); | IN_IFADDR_WLOCK(); | ||||
LIST_REMOVE(ia, ia_hash); | LIST_REMOVE(ia, ia_hash); | ||||
LIST_INSERT_HEAD(INADDR_HASH(si->sin_addr.s_addr), ia, ia_hash); | LIST_INSERT_HEAD(INADDR_HASH(si->sin_addr.s_addr), ia, ia_hash); | ||||
IN_IFADDR_WUNLOCK(); | IN_IFADDR_WUNLOCK(); | ||||
rt_addrmsg(RTM_ADD, ifa, fibnum); | |||||
/* add new route */ | /* add new route */ | ||||
error = rtinit(ifa, (int)RTM_ADD, RTF_HOST); | error = in_handle_ifaddr_rtrequest(RTM_ADD, ia); | ||||
if (debug && error) { | if (debug && error) { | ||||
log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit ADD failed, error=%d", | log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit ADD failed, error=%d", | ||||
SPP_ARGS(ifp), error); | SPP_ARGS(ifp), error); | ||||
} | } | ||||
ifa_free(ifa); | ifa_free(ifa); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 504 Lines • Show Last 20 Lines |