return b0;
case Q_LINK:
+ // "link net NETNAME" and variations thereof
break; // invalid qualifier
case Q_IP:
return gen_host(cstate, n, m, q.proto, q.dir, q.addr);
default:
+ // Q_HOST and Q_GATEWAY only (see the grammar)
bpf_error(cstate, "Mask syntax for networks only");
/*NOTREACHED*/
}
if (proto == Q_DECNET)
return gen_host(cstate, v, 0, proto, dir, q.addr);
else if (proto == Q_LINK) {
+ // "link (host|net) IPV4ADDR" and variations thereof
bpf_error(cstate, "illegal link layer address");
} else {
mask = 0xffffffff;
return b;
default:
+ // Q_GATEWAY only (see the grammar)
bpf_error(cstate, "invalid qualifier against IPv6 address");
/*NOTREACHED*/
}
switch (type) {
case M_FISU:
- /* gen_ncmp(cstate, offrel, offset, size, mask, jtype, reverse, value) */
b0 = gen_ncmp(cstate, OR_PACKET, cstate->off_li, BPF_B,
0x3fU, BPF_JEQ, 0, 0U);
break;
break;
case MH_FISU:
- /* gen_ncmp(cstate, offrel, offset, size, mask, jtype, reverse, value) */
b0 = gen_ncmp(cstate, OR_PACKET, cstate->off_li_hsl, BPF_H,
0xff80U, BPF_JEQ, 0, 0U);
break;
bpf_set_error(cstate, "'protochain' qualifier applied to IPv4 address and prefix length");
YYABORT;
}
+ /* The default case in gen_mcode() catches Q_HOST and Q_GATEWAY. */
CHECK_PTR_VAL(($$.b = gen_mcode(cstate, $1, NULL, $3, $$.q)));
}
| HID NETMASK HID {
bpf_set_error(cstate, "'protochain' qualifier applied to IPv4 address and netmask");
YYABORT;
}
+ /* The default case in gen_mcode() catches Q_HOST and Q_GATEWAY. */
CHECK_PTR_VAL(($$.b = gen_mcode(cstate, $1, $3, 0, $$.q)));
}
| HID {
bpf_set_error(cstate, "'protochain' qualifier applied to IPv6 address and prefix length");
YYABORT;
}
+ /* The default case in gen_mcode6() catches Q_GATEWAY. */
CHECK_PTR_VAL(($$.b = gen_mcode6(cstate, $1, $3, $$.q)));
#else
bpf_set_error(cstate, "IPv6 addresses not supported "
bpf_set_error(cstate, "'protochain' qualifier applied to IPv6 address");
YYABORT;
}
+ /* The default case in gen_mcode6() catches Q_GATEWAY. */
CHECK_PTR_VAL(($$.b = gen_mcode6(cstate, $1, 128, $$.q)));
#else
bpf_set_error(cstate, "IPv6 addresses not supported "