Message ID | 20240509223213.97389-12-newtwen+github@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Ansuel Smith |
Headers | show |
Series | odhcpd config value clamping | expand |
On Fri, May 10, 2024 at 12:30:43AM +0200, Paul Donald wrote: > From: Paul Donald <newtwen@gmail.com> > > Attempt to be helpful. > > Signed-off-by: Paul Donald <newtwen@gmail.com> > --- > src/config.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/src/config.c b/src/config.c > index e0f2d80..160d7db 100644 > --- a/src/config.c > +++ b/src/config.c > @@ -951,11 +951,10 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr > if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) { > uint32_t ra_retranstime = blobmsg_get_u32(c); > > - if (ra_retranstime <= 60000) > - iface->ra_retranstime = ra_retranstime; > - else > - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'", > - iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name); > + iface->ra_retranstime = (ra_retranstime <= 60000) ? ra_retranstime : 60000; > + if (ra_retranstime > 60000) > + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d", > + iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name, iface->ra_retranstime); Same comments as prev patch. > } > > if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) { > -- > 2.44.0 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff --git a/src/config.c b/src/config.c index e0f2d80..160d7db 100644 --- a/src/config.c +++ b/src/config.c @@ -951,11 +951,10 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) { uint32_t ra_retranstime = blobmsg_get_u32(c); - if (ra_retranstime <= 60000) - iface->ra_retranstime = ra_retranstime; - else - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'", - iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name); + iface->ra_retranstime = (ra_retranstime <= 60000) ? ra_retranstime : 60000; + if (ra_retranstime > 60000) + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d", + iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name, iface->ra_retranstime); } if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) {