X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fconfig.c;h=fd334ef2e8a3108697ebcf5e7d0ff2ccf9d7f82b;hp=d6b4e81ab027e8cdbfa1d0784837f4f71afbcb88;hb=5683dd25da56c66e0a5c86e770b8ee2188ad569c;hpb=9dd5316deae6402de68ddc8a08d1a6b496101828 diff --git a/src/config.c b/src/config.c index d6b4e81..fd334ef 100644 --- a/src/config.c +++ b/src/config.c @@ -50,6 +50,9 @@ enum { IFACE_ATTR_RA_MAXINTERVAL, IFACE_ATTR_RA_LIFETIME, IFACE_ATTR_RA_USELEASETIME, + IFACE_ATTR_RA_REACHABLETIME, + IFACE_ATTR_RA_RETRANSTIME, + IFACE_ATTR_RA_HOPLIMIT, IFACE_ATTR_RA_MTU, IFACE_ATTR_PD_MANAGER, IFACE_ATTR_PD_CER, @@ -89,6 +92,9 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = { [IFACE_ATTR_RA_MAXINTERVAL] = { .name = "ra_maxinterval", .type = BLOBMSG_TYPE_INT32 }, [IFACE_ATTR_RA_LIFETIME] = { .name = "ra_lifetime", .type = BLOBMSG_TYPE_INT32 }, [IFACE_ATTR_RA_USELEASETIME] = { .name = "ra_useleasetime", .type = BLOBMSG_TYPE_BOOL }, + [IFACE_ATTR_RA_REACHABLETIME] = { .name = "ra_reachabletime", .type = BLOBMSG_TYPE_INT32 }, + [IFACE_ATTR_RA_RETRANSTIME] = { .name = "ra_retranstime", .type = BLOBMSG_TYPE_INT32 }, + [IFACE_ATTR_RA_HOPLIMIT] = { .name = "ra_hoplimit", .type = BLOBMSG_TYPE_INT32 }, [IFACE_ATTR_RA_MTU] = { .name = "ra_mtu", .type = BLOBMSG_TYPE_INT32 }, [IFACE_ATTR_NDPROXY_ROUTING] = { .name = "ndproxy_routing", .type = BLOBMSG_TYPE_BOOL }, [IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = BLOBMSG_TYPE_BOOL }, @@ -596,10 +602,30 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_MANAGEMENT])) iface->managed = blobmsg_get_u32(c); + if ((c = tb[IFACE_ATTR_RA_REACHABLETIME])) { + iface->ra_reachabletime = blobmsg_get_u32(c); + if (iface->ra_reachabletime > 3600000) + goto err; + } + + if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) { + iface->ra_retranstime = blobmsg_get_u32(c); + if (iface->ra_retranstime > 60000) + goto err; + } + + if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) { + iface->ra_hoplimit = blobmsg_get_u32(c); + if (iface->ra_hoplimit > 255) + goto err; + } + if ((c = tb[IFACE_ATTR_RA_MTU])) { - iface->ra_mtu = blobmsg_get_u32(c); - if (iface->ra_mtu < 1280) + uint32_t ra_mtu = blobmsg_get_u32(c); + if (ra_mtu < 1280 || ra_mtu > 65535) goto err; + + iface->ra_mtu = ra_mtu; } if ((c = tb[IFACE_ATTR_RA_OFFLINK]))