"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/if.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.

if.c  (dhcpcd-7.1.0.tar.xz):if.c  (dhcpcd-7.1.1.tar.xz)
skipping to change at line 81 skipping to change at line 81
#include "ipv4ll.h" #include "ipv4ll.h"
#include "ipv6nd.h" #include "ipv6nd.h"
#include "logerr.h" #include "logerr.h"
void void
if_free(struct interface *ifp) if_free(struct interface *ifp)
{ {
if (ifp == NULL) if (ifp == NULL)
return; return;
#ifdef IPV4LL
ipv4ll_free(ifp); ipv4ll_free(ifp);
#endif
#ifdef INET
dhcp_free(ifp); dhcp_free(ifp);
ipv4_free(ifp); ipv4_free(ifp);
#endif
#ifdef DHCP6
dhcp6_free(ifp); dhcp6_free(ifp);
#endif
#ifdef INET6
ipv6nd_free(ifp); ipv6nd_free(ifp);
ipv6_free(ifp); ipv6_free(ifp);
#endif
rt_freeif(ifp); rt_freeif(ifp);
free_options(ifp->ctx, ifp->options); free_options(ifp->ctx, ifp->options);
free(ifp); free(ifp);
} }
int int
if_opensockets(struct dhcpcd_ctx *ctx) if_opensockets(struct dhcpcd_ctx *ctx)
{ {
if (if_opensockets_os(ctx) == -1) if (if_opensockets_os(ctx) == -1)
skipping to change at line 150 skipping to change at line 158
strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFFLAGS, &ifr) == -1) if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFFLAGS, &ifr) == -1)
return LINK_UNKNOWN; return LINK_UNKNOWN;
ifp->flags = (unsigned int)ifr.ifr_flags; ifp->flags = (unsigned int)ifr.ifr_flags;
#ifdef SIOCGIFMEDIA #ifdef SIOCGIFMEDIA
memset(&ifmr, 0, sizeof(ifmr)); memset(&ifmr, 0, sizeof(ifmr));
strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name)); strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name));
if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFMEDIA, &ifmr) != -1 && if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFMEDIA, &ifmr) != -1 &&
ifmr.ifm_status & IFM_AVALID) ifmr.ifm_status & IFM_AVALID)
{
ifp->media_valid = true;
r = (ifmr.ifm_status & IFM_ACTIVE) ? LINK_UP : LINK_DOWN; r = (ifmr.ifm_status & IFM_ACTIVE) ? LINK_UP : LINK_DOWN;
else } else {
ifp->media_valid = false;
r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_UNKNOWN; r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_UNKNOWN;
}
#else #else
r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_DOWN; r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_DOWN;
#endif #endif
return r; return r;
} }
int int
if_setflag(struct interface *ifp, short flag) if_setflag(struct interface *ifp, short flag)
{ {
struct ifreq ifr; struct ifreq ifr;
skipping to change at line 465 skipping to change at line 477
ifp->index = sdl->sdl_index; ifp->index = sdl->sdl_index;
switch(sdl->sdl_type) { switch(sdl->sdl_type) {
#ifdef IFT_BRIDGE #ifdef IFT_BRIDGE
case IFT_BRIDGE: /* FALLTHROUGH */ case IFT_BRIDGE: /* FALLTHROUGH */
#endif #endif
#ifdef IFT_PPP #ifdef IFT_PPP
case IFT_PPP: /* FALLTHROUGH */ case IFT_PPP: /* FALLTHROUGH */
#endif #endif
#ifdef IFT_PROPVIRTUAL #ifdef IFT_PROPVIRTUAL
case IFT_PROPVIRTUAL: /* FALLTHROUGH */ case IFT_PROPVIRTUAL:
#endif #endif
#if defined(IFT_BRIDGE) || defined(IFT_PPP) || defined(IFT_PROPVIRTUAL) #if defined(IFT_BRIDGE) || defined(IFT_PPP) || defined(IFT_PROPVIRTUAL)
/* Don't allow unless explicit */ /* Don't allow unless explicit */
if ((argc == 0 || argc == -1) && if ((argc == 0 || argc == -1) &&
ctx->ifac == 0 && active && ctx->ifac == 0 && active &&
!if_hasconf(ctx, ifp->name)) !if_hasconf(ctx, ifp->name))
{ {
logdebugx("%s: ignoring due to" logdebugx("%s: ignoring due to"
" interface type and" " interface type and"
" no config", " no config",
ifp->name); ifp->name);
active = IF_INACTIVE; active = IF_INACTIVE;
} }
__fallthrough; /* Appease gcc-7 */
/* FALLTHROUGH */ /* FALLTHROUGH */
#endif #endif
#ifdef IFT_L2VLAN #ifdef IFT_L2VLAN
case IFT_L2VLAN: /* FALLTHROUGH */ case IFT_L2VLAN: /* FALLTHROUGH */
#endif #endif
#ifdef IFT_L3IPVLAN #ifdef IFT_L3IPVLAN
case IFT_L3IPVLAN: /* FALLTHROUGH */ case IFT_L3IPVLAN: /* FALLTHROUGH */
#endif #endif
case IFT_ETHER: case IFT_ETHER:
ifp->family = ARPHRD_ETHER; ifp->family = ARPHRD_ETHER;
skipping to change at line 587 skipping to change at line 600
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
if (ioctl(ctx->pf_inet_fd, SIOCGIFPRIORITY, &ifr) == 0) if (ioctl(ctx->pf_inet_fd, SIOCGIFPRIORITY, &ifr) == 0)
ifp->metric = (unsigned int)ifr.ifr_metric; ifp->metric = (unsigned int)ifr.ifr_metric;
if_getssid(ifp); if_getssid(ifp);
#else #else
/* We reserve the 100 range for virtual interfaces, if and when /* We reserve the 100 range for virtual interfaces, if and when
* we can work them out. */ * we can work them out. */
ifp->metric = 200 + ifp->index; ifp->metric = 200 + ifp->index;
if (if_getssid(ifp) != -1) { if (if_getssid(ifp) != -1) {
ifp->wireless = 1; ifp->wireless = true;
ifp->metric += 100; ifp->metric += 100;
} }
#endif #endif
ifp->active = active; ifp->active = active;
if (ifp->active) if (ifp->active)
ifp->carrier = if_carrier(ifp); ifp->carrier = if_carrier(ifp);
else else
ifp->carrier = LINK_UNKNOWN; ifp->carrier = LINK_UNKNOWN;
TAILQ_INSERT_TAIL(ifs, ifp, next); TAILQ_INSERT_TAIL(ifs, ifp, next);
skipping to change at line 729 skipping to change at line 742
if (si->active > ti->active) if (si->active > ti->active)
return -1; return -1;
if (si->active < ti->active) if (si->active < ti->active)
return 1; return 1;
/* Check carrier status next */ /* Check carrier status next */
if (si->carrier > ti->carrier) if (si->carrier > ti->carrier)
return -1; return -1;
if (si->carrier < ti->carrier) if (si->carrier < ti->carrier)
return 1; return 1;
#ifdef INET
if (D_STATE_RUNNING(si) && !D_STATE_RUNNING(ti)) if (D_STATE_RUNNING(si) && !D_STATE_RUNNING(ti))
return -1; return -1;
if (!D_STATE_RUNNING(si) && D_STATE_RUNNING(ti)) if (!D_STATE_RUNNING(si) && D_STATE_RUNNING(ti))
return 1; return 1;
#endif
#ifdef INET6
if (RS_STATE_RUNNING(si) && !RS_STATE_RUNNING(ti)) if (RS_STATE_RUNNING(si) && !RS_STATE_RUNNING(ti))
return -1; return -1;
if (!RS_STATE_RUNNING(si) && RS_STATE_RUNNING(ti)) if (!RS_STATE_RUNNING(si) && RS_STATE_RUNNING(ti))
return 1; return 1;
#endif
#ifdef DHCP6
if (D6_STATE_RUNNING(si) && !D6_STATE_RUNNING(ti)) if (D6_STATE_RUNNING(si) && !D6_STATE_RUNNING(ti))
return -1; return -1;
if (!D6_STATE_RUNNING(si) && D6_STATE_RUNNING(ti)) if (!D6_STATE_RUNNING(si) && D6_STATE_RUNNING(ti))
return 1; return 1;
#endif
#ifdef INET #ifdef INET
/* Special attention needed here due to states and IPv4LL. */ /* Special attention needed here due to states and IPv4LL. */
if ((r = ipv4_ifcmp(si, ti)) != 0) if ((r = ipv4_ifcmp(si, ti)) != 0)
return r; return r;
#endif #endif
/* Finally, metric */ /* Finally, metric */
if (si->metric < ti->metric) if (si->metric < ti->metric)
return -1; return -1;
 End of changes. 15 change blocks. 
4 lines changed or deleted 22 lines changed or added

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