uint16_t hwtype; /* ARPHRD_ETHER for example */
unsigned char hwaddr[HWADDR_LEN];
uint8_t hwlen;
- unsigned int mtu;
+ int mtu;
unsigned short vlanid;
unsigned int metric;
int carrier;
if ((ifp = if_findindex(ctx->ifaces, ifm->ifm_index)) == NULL)
return 0;
- ifp->mtu = if_mtu(ifp);
+ ifp->mtu = if_getmtu(ifp);
link_state = if_carrier(ifp, &ifm->ifm_data);
dhcpcd_handlecarrier(ifp, link_state, (unsigned int)ifm->ifm_flags);
return 0;
return 0;
}
-unsigned int
-if_mtu(struct interface *ifp)
-{
- struct ifreq ifr = { .ifr_mtu = 0 };
-
- strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
- if (if_ioctl(ifp->ctx, SIOCGIFMTU, &ifr, sizeof(ifr)) == -1)
- return 0;
-
- return (unsigned int)ifr.ifr_mtu;
-}
-
bool
if_is_link_up(const struct interface *ifp)
{
}
}
- ifp->mtu = if_mtu(ifp);
+ ifp->mtu = if_getmtu(ifp);
ifp->vlanid = if_vlanid(ifp);
#ifdef SIOCGIFPRIORITY
#define pioctl(ctx, req, data, len) ioctl((ctx)->pf_inet_fd, (req),(data),(len))
#endif
int if_setflag(struct interface *, short, short);
-unsigned int if_mtu(struct interface *);
+int if_getmtu(const struct interface *);
#define if_up(ifp) if_setflag((ifp), (IFF_UP | IFF_RUNNING), 0)
#define if_down(ifp) if_setflag((ifp), 0, IFF_UP);
bool if_is_link_up(const struct interface *);
struct interface *if_findindex(struct if_head *, unsigned int);
struct interface *if_loopback(struct dhcpcd_ctx *);
void if_free(struct interface *);
-int if_getmtu(const struct interface *);
int if_carrier(struct interface *, const void *);
bool if_roaming(struct interface *);
* if the route does not define it's own. */
unsigned int nmtu, omtu;
- nmtu = nrt->rt_mtu ? nrt->rt_mtu : nrt->rt_ifp->mtu;
- omtu = ort->rt_mtu ? ort->rt_mtu : ort->rt_ifp->mtu;
+ nmtu = nrt->rt_mtu ? nrt->rt_mtu : (unsigned int)nrt->rt_ifp->mtu;
+ omtu = ort->rt_mtu ? ort->rt_mtu : (unsigned int)ort->rt_ifp->mtu;
if (omtu != nmtu)
return false;
#else