FreeBSD/sbin/ipfw/ipv6.c
/*
 * fills command for ipv6 flow-id filtering
 * note that the 20 bit flow number is stored in a array of u_int32_t
 * it's supported lists of flow-id, so in the o.arg1 we store how many
 * additional flow-id we want to filter, the basic is 1
 */
fills command for ipv6 flow-id filtering
note that the 20 bit flow number is stored in a array of u_int32_t
it's supported lists of flow-id, so in the o.arg1 we store how many
additional flow-id we want to filter, the basic is 1
fills command for ipv6 flow - id filtering note that the 20 bit flow number is stored in a array of u_int32_t it ' s supported lists of flow - id so in the o . arg1 we store how many additional flow - id we want to filter the basic is 1
void
fill_flow6( ipfw_insn_u32 *cmd, char *av, int cblen)
{
	u_int32_t type;	 
	u_int16_t nflow = 0;    
	char *s = av;
	cmd->d[0] = 0;	  
	while (s) {
		CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_u32) + nflow + 1);
		av = strsep( &s, ",") ;
		type = strtoul(av, &av, 0);
		if (*av != ',' && *av != '\0')
			errx(EX_DATAERR, "invalid ipv6 flow number %s", av);
		if (type > 0xfffff)
			errx(EX_DATAERR, "flow number out of range %s", av);
		cmd->d[nflow] |= type;
		nflow++;
	}
	if( nflow > 0 ) {
		cmd->o.opcode = O_FLOW6ID;
		cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32) + nflow;
		cmd->o.arg1 = nflow;
	}
	else {
		errx(EX_DATAERR, "invalid ipv6 flow number %s", av);
	}
}
void fill_flow6 ( ipfw_insn_u32 * cmd , char * av , int cblen ) { u_int32_t type ; u_int16_t nflow = 0 ; char * s = av ; cmd -> d [ 0 ] = 0 ; while ( s ) { CHECK_LENGTH ( cblen , F_INSN_SIZE ( ipfw_insn_u32 ) + nflow + 1 ) ; av = strsep ( & s , " " ) ; type = strtoul ( av , & av , 0 ) ; if ( * av != ' ' && * av != ' \0 ' ) errx ( EX_DATAERR , " " , av ) ; if ( type > 0xfffff ) errx ( EX_DATAERR , " " , av ) ; cmd -> d [ nflow ] |= type ; nflow ++ ; } if ( nflow > 0 ) { cmd -> o . opcode = O_FLOW6ID ; cmd -> o . len |= F_INSN_SIZE ( ipfw_insn_u32 ) + nflow ; cmd -> o . arg1 = nflow ; } else { errx ( EX_DATAERR , " " , av ) ; } }
fills command for ipv6 flow-id filtering
 note that the 20 bit flow number is stored in a array of u_int32_t
 it's supported lists of flow-id, so in the o.arg1 we store how many
 additional flow-id we want to filter, the basic is 1
fills command for ipv6 flow - id filtering note that the 20 bit flow number is stored in a array of u_int32_t it ' s supported lists of flow - id so in the o . arg1 we store how many additional flow - id we want to filter the basic is 1
/* Current flow number */ /* Current flow index */ /* Initializing the base number*/