confusions in the source code
jayce lee
Fri Apr 05 20:03:29 2013
I got to read the source code and came up with some confusion. Could you
please give me some help.
in the structure if_options
struct if_options {
int metric;
uint8_t requestmask[256 / 8];
uint8_t requiremask[256 / 8];
uint8_t nomask[256 / 8];
uint8_t requestmask6[(UINT16_MAX + 1) / 8];
uint8_t requiremask6[(UINT16_MAX + 1) / 8];
uint8_t nomask6[(UINT16_MAX + 1) / 8];
……
}
there are some masks, what's the function of the mask and why for ipv4 the
size of mask is 256/8 and for ipv6 the size is UINT16_MAX + 1 /8 ?
By the way, in the parse_config process, the function make_option_mask
change the mask value in add_option_mask(mask,opt->option);
The macro definition is #define add_option_mask(var, val) (var[val >> 3] |=
1 << (val & 7)), I can't quite get the purpose of the source code.
Could someone give me explanations?
Thank you!
Archive administrator: postmaster@marples.name