X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=system-linux.c;h=c6d81e60459f08165cd05ebfdec35d0250be68b3;hp=76740f7d6078c64c94cf58b842e3579c320b9a3f;hb=b19c14ca2ea5594d37bd3492ad147047eed4703f;hpb=97e748de49c02f36a1e75bd9f9552311fb4051b4 diff --git a/system-linux.c b/system-linux.c index 76740f7..c6d81e6 100644 --- a/system-linux.c +++ b/system-linux.c @@ -65,8 +65,6 @@ static void handle_hotplug_event(struct uloop_fd *u, unsigned int events); static char dev_buf[256]; -static bool iprules_flushed = false; - static void handler_nl_event(struct uloop_fd *u, unsigned int events) { @@ -920,17 +918,21 @@ static int system_addr(struct device *dev, struct device_addr *addr, int cmd) struct ifa_cacheinfo cinfo = {0xffffffffU, 0xffffffffU, 0, 0}; if (addr->preferred_until) { - int preferred = addr->preferred_until - now; + int64_t preferred = addr->preferred_until - now; if (preferred < 0) preferred = 0; + else if (preferred > UINT32_MAX) + preferred = UINT32_MAX; cinfo.ifa_prefered = preferred; } if (addr->valid_until) { - int valid = addr->valid_until - now; + int64_t valid = addr->valid_until - now; if (valid <= 0) return -1; + else if (valid > UINT32_MAX) + valid = UINT32_MAX; cinfo.ifa_valid = valid; } @@ -1179,13 +1181,6 @@ static int system_iprule(struct iprule *rule, int cmd) int system_add_iprule(struct iprule *rule) { - /* trigger flush of existing rules when adding first rule the first time */ - if (!iprules_flushed) - { - system_flush_iprules(); - iprules_flushed = true; - } - return system_iprule(rule, RTM_NEWRULE); }