]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add/remove some comments.
authorDenis Ovsienko <[email protected]>
Sat, 22 Mar 2025 17:40:39 +0000 (17:40 +0000)
committerDenis Ovsienko <[email protected]>
Sun, 23 Mar 2025 20:42:43 +0000 (20:42 +0000)
gencode.c
grammar.y.in

index 75610662e2c84410d7f13b728b1a1ee2b376bef9..b6a837aedf76df77cc2d58d6a22720556b226d97 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -5211,6 +5211,7 @@ gen_host(compiler_state_t *cstate, bpf_u_int32 addr, bpf_u_int32 mask,
                return b0;
 
        case Q_LINK:
+               // "link net NETNAME" and variations thereof
                break; // invalid qualifier
 
        case Q_IP:
@@ -7224,6 +7225,7 @@ gen_mcode(compiler_state_t *cstate, const char *s1, const char *s2,
                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*/
        }
@@ -7289,6 +7291,7 @@ gen_ncode(compiler_state_t *cstate, const char *s, bpf_u_int32 v, struct qual q)
                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;
@@ -7412,6 +7415,7 @@ gen_mcode6(compiler_state_t *cstate, const char *s, bpf_u_int32 masklen,
                return b;
 
        default:
+               // Q_GATEWAY only (see the grammar)
                bpf_error(cstate, "invalid qualifier against IPv6 address");
                /*NOTREACHED*/
        }
@@ -10038,7 +10042,6 @@ gen_mtp2type_abbrev(compiler_state_t *cstate, int type)
        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;
@@ -10057,7 +10060,6 @@ gen_mtp2type_abbrev(compiler_state_t *cstate, int type)
                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;
index b312fca2ff44c46a3b1674cf6245a3bacc156ea9..71f88a3717bfc9a0adca922eee733e549c36d88e 100644 (file)
@@ -466,6 +466,7 @@ nid:          ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                        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       {
@@ -485,6 +486,7 @@ nid:          ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                        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                   {
@@ -524,6 +526,7 @@ nid:          ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                        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 "
@@ -549,6 +552,7 @@ nid:          ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                        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 "