o Fix bug I introduced in the previous commit (ipfw set extention):

pack a set number correctly.

Submitted by:	oleg

o Plug a memory leak.

Submitted by:	oleg and Andrey V. Elsukov
Approved by:	re (kensmith)
MFC after:	1 week
This commit is contained in:
Maxim Konovalov 2007-08-26 18:38:31 +00:00
parent 8f82ec1165
commit 4a296ec798
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171989
2 changed files with 7 additions and 4 deletions

View File

@ -2575,7 +2575,7 @@ list(int ac, char *av[], int show_counters)
for (n = 0, d = dynrules; n < ndyn; n++, d++) {
if (use_set) {
/* skip rules from another set */
bcopy(&d->rule + sizeof(uint16_t),
bcopy((char *)&d->rule + sizeof(uint16_t),
&set, sizeof(uint8_t));
if (set != use_set - 1)
continue;
@ -2603,7 +2603,7 @@ list(int ac, char *av[], int show_counters)
printf("## Dynamic rules (%d):\n", ndyn);
for (n = 0, d = dynrules; n < ndyn; n++, d++) {
if (use_set) {
bcopy(&d->rule + sizeof(uint16_t),
bcopy((char *)&d->rule + sizeof(uint16_t),
&set, sizeof(uint8_t));
if (set != use_set - 1)
continue;
@ -2660,7 +2660,7 @@ list(int ac, char *av[], int show_counters)
if (rulenum > rnum)
break;
if (use_set) {
bcopy(&d->rule + sizeof(uint16_t),
bcopy((char *)&d->rule + sizeof(uint16_t),
&set, sizeof(uint8_t));
if (set != use_set - 1)
continue;

View File

@ -4404,7 +4404,8 @@ ipfw_getrules(struct ip_fw_chain *chain, void *buf, size_t space)
* store set number into high word of
* dst->rule pointer.
*/
bcopy(&(p->rule->set), &dst->rule +
bcopy(&(p->rule->set),
(char *)&dst->rule +
sizeof(p->rule->rulenum),
sizeof(p->rule->set));
/*
@ -5042,6 +5043,8 @@ ipfw_destroy(void)
reap_rules(reap);
IPFW_DYN_LOCK_DESTROY();
uma_zdestroy(ipfw_dyn_rule_zone);
if (ipfw_dyn_v != NULL)
free(ipfw_dyn_v, M_IPFW);
IPFW_LOCK_DESTROY(&layer3_chain);
#ifdef INET6