diff options
author | julian <julian@FreeBSD.org> | 2007-04-03 22:45:50 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2007-04-03 22:45:50 +0000 |
commit | cd89273202c5020ecb298750dd1c7926e03fc318 (patch) | |
tree | 1cffc34815daa53e6e82d7f6a7cacaf90d0a18ae /sys/netinet/ip_fw2.c | |
parent | 3ed55b8adb271c57e480c98d499ff2833acdcdcf (diff) | |
download | FreeBSD-src-cd89273202c5020ecb298750dd1c7926e03fc318.zip FreeBSD-src-cd89273202c5020ecb298750dd1c7926e03fc318.tar.gz |
Since we switched to using monatomically increasing timestamps,
they have been reported back to the userland as being in 1970.
Add boot time to the timestamp to give the time in the scale of the 'current'
real timescale. Not perfect if you change the time a lot but good enough
to keep all the rules correct relative to each other correct in terms
of time relative to "now".
Diffstat (limited to 'sys/netinet/ip_fw2.c')
-rw-r--r-- | sys/netinet/ip_fw2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index ce6a066..cdf746b 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -4328,7 +4328,9 @@ ipfw_getrules(struct ip_fw_chain *chain, void *buf, size_t space) char *ep = bp + space; struct ip_fw *rule; int i; + time_t boot_seconds; + boot_seconds = boottime.tv_sec; /* XXX this can take a long time and locking will block packet flow */ IPFW_RLOCK(chain); for (rule = chain->rules; rule ; rule = rule->next) { @@ -4341,8 +4343,15 @@ ipfw_getrules(struct ip_fw_chain *chain, void *buf, size_t space) i = RULESIZE(rule); if (bp + i <= ep) { bcopy(rule, bp, i); + /* + * XXX HACK. Store the disable mask in the "next" pointer + * in a wild attempt to keep the ABI the same. + * Why do we do this on EVERY rule? + */ bcopy(&set_disable, &(((struct ip_fw *)bp)->next_rule), sizeof(set_disable)); + if (((struct ip_fw *)bp)->timestamp) + ((struct ip_fw *)bp)->timestamp += boot_seconds; bp += i; } } |