Fixed ipv6 problem in iptables.c

This commit is contained in:
john 2021-02-26 10:55:56 -05:00
parent af57115d23
commit 41f9de69f1
2 changed files with 16 additions and 9 deletions

View File

@ -92,7 +92,7 @@ struct Global G= {
.version= {
.major= 0,
.minor= 14,
.patch= 4
.patch= 5
},
.bitTuples.flags= GlobalFlagBitTuples

View File

@ -320,14 +320,12 @@ _control_addresses(const char *cmdFlag, PTRVEC *h_vec)
{ // ipv6 addresses
argv[0]= IP6TABLES;
// Load up ipv6 addresses in string buffer
// Prepare to load up ipv6 addresses in string buffer
STR_reset(&addr_sb);
unsigned naddr= 0;
do { /* Work through ipv6 addresses in the vector */
addr= PTRVEC_remHead(h_vec);
for(;;) { /* Work through ipv6 addresses in the vector */
if(addr) {
/* Need comma after 1st address */
@ -336,10 +334,16 @@ _control_addresses(const char *cmdFlag, PTRVEC *h_vec)
/* Put address in place */
STR_append(&addr_sb, addr, -1);
/* Note that we will use this address */
++naddr;
}
/* See if there is another address */
addr= PTRVEC_remHead(h_vec);
/* Keep adding addresses until we bump up against iptables maximum,
* or run out of ipv4 addresses
* or run out of addresses
*/
if(!naddr || (naddr < IPTABLES_MAX_ADDR && addr))
continue;
@ -351,11 +355,14 @@ _control_addresses(const char *cmdFlag, PTRVEC *h_vec)
goto abort;
}
/* Bail out now if we are done with the list */
if(!addr)
break;
/* Reset for next command */
naddr= 0;
STR_reset(&addr_sb);
} while(addr);
}
}
rtn= 0;