"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ipv4.c" between
dhcpcd-7.1.0.tar.xz and dhcpcd-7.1.1.tar.xz

About: dhcpcd is a RFC2131 compliant DHCP (Dynamic Host Configuration Protocol) client.

ipv4.c  (dhcpcd-7.1.0.tar.xz):ipv4.c  (dhcpcd-7.1.1.tar.xz)
skipping to change at line 203 skipping to change at line 203
return ap; return ap;
} }
return NULL; return NULL;
} }
int int
ipv4_hasaddr(const struct interface *ifp) ipv4_hasaddr(const struct interface *ifp)
{ {
const struct dhcp_state *dstate; const struct dhcp_state *dstate;
#ifdef IPV4LL
if (IPV4LL_STATE_RUNNING(ifp)) if (IPV4LL_STATE_RUNNING(ifp))
return 1; return 1;
#endif
dstate = D_CSTATE(ifp); dstate = D_CSTATE(ifp);
return (dstate && return (dstate &&
dstate->added == STATE_ADDED && dstate->added == STATE_ADDED &&
dstate->addr != NULL); dstate->addr != NULL);
} }
/* Interface comparer for working out ordering. */ /* Interface comparer for working out ordering. */
int int
ipv4_ifcmp(const struct interface *si, const struct interface *ti) ipv4_ifcmp(const struct interface *si, const struct interface *ti)
skipping to change at line 428 skipping to change at line 430
sa_in_init(&rth->rt_ifa, &state->addr->addr); sa_in_init(&rth->rt_ifa, &state->addr->addr);
TAILQ_INSERT_BEFORE(rt, rth, rt_next); TAILQ_INSERT_BEFORE(rt, rth, rt_next);
} }
return 0; return 0;
} }
bool bool
inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes) inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
{ {
struct interface *ifp; struct interface *ifp;
#ifdef IPV4LL
struct rt def; struct rt def;
bool have_default; bool have_default;
#endif
TAILQ_FOREACH(ifp, ctx->ifaces, next) { TAILQ_FOREACH(ifp, ctx->ifaces, next) {
if (!ifp->active) if (!ifp->active)
continue; continue;
if (inet_dhcproutes(routes, ifp) == -1) if (inet_dhcproutes(routes, ifp) == -1)
return false; return false;
#ifdef IPV4LL
if (ipv4ll_subnetroute(routes, ifp) == -1) if (ipv4ll_subnetroute(routes, ifp) == -1)
return false; return false;
#endif
if (inet_routerhostroute(routes, ifp) == -1) if (inet_routerhostroute(routes, ifp) == -1)
return false; return false;
} }
#ifdef IPV4LL
/* If there is no default route, see if we can use an IPv4LL one. */ /* If there is no default route, see if we can use an IPv4LL one. */
memset(&def, 0, sizeof(def)); memset(&def, 0, sizeof(def));
def.rt_dest.sa_family = AF_INET; def.rt_dest.sa_family = AF_INET;
have_default = (rt_find(routes, &def) != NULL); have_default = (rt_find(routes, &def) != NULL);
if (!have_default) { if (!have_default) {
TAILQ_FOREACH(ifp, ctx->ifaces, next) { TAILQ_FOREACH(ifp, ctx->ifaces, next) {
if (ifp->active && if (ifp->active &&
ipv4ll_defaultroute(routes, ifp) == 1) ipv4ll_defaultroute(routes, ifp) == 1)
break; break;
} }
} }
#endif
return true; return true;
} }
int int
ipv4_deladdr(struct ipv4_addr *addr, int keeparp) ipv4_deladdr(struct ipv4_addr *addr, int keeparp)
{ {
int r; int r;
struct ipv4_state *state; struct ipv4_state *state;
struct ipv4_addr *ap; struct ipv4_addr *ap;
skipping to change at line 701 skipping to change at line 709
if (state == NULL) if (state == NULL)
return; return;
lease = &state->lease; lease = &state->lease;
if (state->new == NULL) { if (state->new == NULL) {
if ((ifo->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != if ((ifo->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) !=
(DHCPCD_EXITING | DHCPCD_PERSISTENT)) (DHCPCD_EXITING | DHCPCD_PERSISTENT))
{ {
if (state->added) { if (state->added) {
struct in_addr addr;
addr = lease->addr;
delete_address(ifp); delete_address(ifp);
rt_build(ifp->ctx, AF_INET); rt_build(ifp->ctx, AF_INET);
#ifdef ARP #ifdef ARP
/* Announce the preferred address to /* Announce the preferred address to
* kick ARP caches. */ * kick ARP caches. */
arp_announceaddr(ifp->ctx, &addr); arp_announceaddr(ifp->ctx, &lease->addr);
#endif #endif
} }
script_runreason(ifp, state->reason); script_runreason(ifp, state->reason);
} else } else
rt_build(ifp->ctx, AF_INET); rt_build(ifp->ctx, AF_INET);
return; return;
} }
/* If the netmask or broadcast is different, re-add the addresss */ /* If the netmask or broadcast is different, re-add the addresss */
ia = ipv4_iffindaddr(ifp, &lease->addr, NULL); ia = ipv4_iffindaddr(ifp, &lease->addr, NULL);
 End of changes. 10 change blocks. 
4 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)