}
static struct rt *
-get_routes(const struct interface *iface)
+get_routes(struct interface *iface)
{
struct rt *rt, *nrt = NULL, *r = NULL;
return nrt;
}
- return get_option_routes(iface->state->new,
- iface->name, &iface->state->options->options);
+ return get_option_routes(iface, iface->state->new);
}
/* Some DHCP servers add set host routes by setting the gateway
build_routes(void)
{
struct rt *nrs = NULL, *dnr, *or, *rt, *rtn, *rtl, *lrt = NULL;
- const struct interface *ifp;
+ struct interface *ifp;
for (ifp = ifaces; ifp; ifp = ifp->next) {
if (ifp->state->new == NULL)
* If we have a CSR then we only use that.
* Otherwise we add static routes and then routers. */
struct rt *
-get_option_routes(const struct dhcp_message *dhcp,
- const char *ifname, unsigned long long *opts)
+get_option_routes(struct interface *ifp, const struct dhcp_message *dhcp)
{
+ struct if_options *ifo = ifp->state->options;
const uint8_t *p;
const uint8_t *e;
struct rt *routes = NULL;
int len;
/* If we have CSR's then we MUST use these only */
- p = get_option(dhcp, DHO_CSR, &len, NULL);
+ if (!has_option_mask(ifo->nomask, DHO_CSR))
+ p = get_option(dhcp, DHO_CSR, &len, NULL);
+ else
+ p = NULL;
/* Check for crappy MS option */
- if (!p)
+ if (!p && !has_option_mask(ifo->nomask, DHO_MSCSR))
p = get_option(dhcp, DHO_MSCSR, &len, NULL);
if (p) {
routes = decode_rfc3442_rt(len, p);
if (routes) {
- if (!(*opts & DHCPCD_CSR_WARNED)) {
+ if (!(ifo->options & DHCPCD_CSR_WARNED)) {
syslog(LOG_DEBUG,
"%s: using Classless Static Routes",
- ifname);
- *opts |= DHCPCD_CSR_WARNED;
+ ifp->name);
+ ifo->options |= DHCPCD_CSR_WARNED;
}
return routes;
}
}
/* OK, get our static routes first. */
- p = get_option(dhcp, DHO_STATICROUTE, &len, NULL);
+ if (!has_option_mask(ifo->nomask, DHO_STATICROUTE))
+ p = get_option(dhcp, DHO_STATICROUTE, &len, NULL);
if (p) {
e = p + len;
while (p < e) {
}
/* Now grab our routers */
- p = get_option(dhcp, DHO_ROUTER, &len, NULL);
+ if (!has_option_mask(ifo->nomask, DHO_ROUTER))
+ p = get_option(dhcp, DHO_ROUTER, &len, NULL);
+ else
+ p = NULL;
if (p) {
e = p + len;
while (p < e) {
#define is_bootp(m) (m && \
!IN_LINKLOCAL(htonl((m)->yiaddr)) && \
get_option_uint8(NULL, m, DHO_MESSAGETYPE) == -1)
-struct rt *get_option_routes(const struct dhcp_message *, const char *,
- unsigned long long *);
+struct rt *get_option_routes(struct interface *, const struct dhcp_message *);
ssize_t decode_rfc3397(char *, ssize_t, int, const uint8_t *);
ssize_t print_string(char *, ssize_t, int, const uint8_t *);
ssize_t configure_env(char **, const char *, const struct dhcp_message *,