--- embedaddon/dnsmasq/src/outpacket.c 2013/07/29 19:37:40 1.1.1.1 +++ embedaddon/dnsmasq/src/outpacket.c 2021/03/17 00:56:46 1.1.1.4 @@ -1,4 +1,4 @@ -/* dnsmasq is Copyright (c) 2000-2013 Simon Kelley +/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,9 +29,19 @@ void end_opt6(int container) PUTSHORT(len, p); } +void reset_counter(void) +{ + /* Clear out buffer when starting from beginning */ + if (daemon->outpacket.iov_base) + memset(daemon->outpacket.iov_base, 0, daemon->outpacket.iov_len); + + save_counter(0); +} + int save_counter(int newval) { int ret = outpacket_counter; + if (newval != -1) outpacket_counter = newval; @@ -70,9 +80,9 @@ void *put_opt6(void *data, size_t len) { void *p; - if ((p = expand(len))) + if ((p = expand(len)) && data) memcpy(p, data, len); - + return p; }