]> The Tcpdump Group git mirrors - libpcap/commitdiff
Make pcap_compile() error messages more uniform and consistent.
authorDenis Ovsienko <[email protected]>
Fri, 21 Mar 2025 12:11:59 +0000 (12:11 +0000)
committerDenis Ovsienko <[email protected]>
Fri, 21 Mar 2025 12:14:51 +0000 (12:14 +0000)
In the grammar say "qualifier" rather than "modifier" to match the prose
in pcap-filter(7) better (this reduces the terminology inconsistency
described in GitHub bug report #125), also spell IPv4/IPv6 for clarity.

CHANGES
grammar.y.in
testprogs/TESTrun

diff --git a/CHANGES b/CHANGES
index 83d7dd15a7a23f08e8aa1107e214351a752723c9..d0def799fa392123e766f4a8b0543c2db59b456e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
         The Riverbed AirPcap Product has reached End of Availability
         (EOA) as of December 31, 2017
       Mind netmap support in pcap_lib_version().
+      Make pcap_compile() error messages more uniform and consistent.
     Link-layer types:
       Add LINKTYPE_ETW/DLT_ETW.
       Add LINKTYPE_NETANALYZER_NG/DLT_NETANALYZER_NG (pull request
index 4df433960e34a9504d1d1785aab7f12f8477f89b..b312fca2ff44c46a3b1674cf6245a3bacc156ea9 100644 (file)
@@ -454,16 +454,16 @@ nid:        ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                  /* Check whether HID/NUM is being used when appropriate */
                                  $$.q = $<blk>0.q;
                                  if ($$.q.addr == Q_PORT) {
-                                       bpf_set_error(cstate, "'port' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'port' qualifier applied to IPv4 address and prefix length");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PORTRANGE) {
-                                       bpf_set_error(cstate, "'portrange' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'portrange' qualifier applied to IPv4 address and prefix length");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTO) {
-                                       bpf_set_error(cstate, "'proto' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'proto' qualifier applied to IPv4 address and prefix length");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTOCHAIN) {
-                                       bpf_set_error(cstate, "'protochain' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'protochain' qualifier applied to IPv4 address and prefix length");
                                        YYABORT;
                                  }
                                  CHECK_PTR_VAL(($$.b = gen_mcode(cstate, $1, NULL, $3, $$.q)));
@@ -473,16 +473,16 @@ nid:        ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                  /* Check whether HID mask HID is being used when appropriate */
                                  $$.q = $<blk>0.q;
                                  if ($$.q.addr == Q_PORT) {
-                                       bpf_set_error(cstate, "'port' modifier applied to IP address and netmask");
+                                       bpf_set_error(cstate, "'port' qualifier applied to IPv4 address and netmask");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PORTRANGE) {
-                                       bpf_set_error(cstate, "'portrange' modifier applied to IP address and netmask");
+                                       bpf_set_error(cstate, "'portrange' qualifier applied to IPv4 address and netmask");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTO) {
-                                       bpf_set_error(cstate, "'proto' modifier applied to IP address and netmask");
+                                       bpf_set_error(cstate, "'proto' qualifier applied to IPv4 address and netmask");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTOCHAIN) {
-                                       bpf_set_error(cstate, "'protochain' modifier applied to IP address and netmask");
+                                       bpf_set_error(cstate, "'protochain' qualifier applied to IPv4 address and netmask");
                                        YYABORT;
                                  }
                                  CHECK_PTR_VAL(($$.b = gen_mcode(cstate, $1, $3, 0, $$.q)));
@@ -492,16 +492,16 @@ nid:        ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                  /* Check whether HID is being used when appropriate */
                                  $$.q = $<blk>0.q;
                                  if ($$.q.addr == Q_PORT) {
-                                       bpf_set_error(cstate, "'port' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'port' qualifier applied to IPv4 address");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PORTRANGE) {
-                                       bpf_set_error(cstate, "'portrange' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'portrange' qualifier applied to IPv4 address");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTO) {
-                                       bpf_set_error(cstate, "'proto' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'proto' qualifier applied to IPv4 address");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTOCHAIN) {
-                                       bpf_set_error(cstate, "'protochain' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'protochain' qualifier applied to IPv4 address");
                                        YYABORT;
                                  }
                                  CHECK_PTR_VAL(($$.b = gen_ncode(cstate, $1, 0, $$.q)));
@@ -512,16 +512,16 @@ nid:        ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                  /* Check whether HID6/NUM is being used when appropriate */
                                  $$.q = $<blk>0.q;
                                  if ($$.q.addr == Q_PORT) {
-                                       bpf_set_error(cstate, "'port' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'port' qualifier applied to IPv6 address and prefix length");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PORTRANGE) {
-                                       bpf_set_error(cstate, "'portrange' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'portrange' qualifier applied to IPv6 address and prefix length");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTO) {
-                                       bpf_set_error(cstate, "'proto' modifier applied to IP address and prefix length ");
+                                       bpf_set_error(cstate, "'proto' qualifier applied to IPv6 address and prefix length ");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTOCHAIN) {
-                                       bpf_set_error(cstate, "'protochain' modifier applied to IP address and prefix length");
+                                       bpf_set_error(cstate, "'protochain' qualifier applied to IPv6 address and prefix length");
                                        YYABORT;
                                  }
                                  CHECK_PTR_VAL(($$.b = gen_mcode6(cstate, $1, $3, $$.q)));
@@ -537,16 +537,16 @@ nid:        ID                    { CHECK_PTR_VAL($1); CHECK_PTR_VAL(($$.b = gen_scode(cstate, $1, $$.
                                  /* Check whether HID6 is being used when appropriate */
                                  $$.q = $<blk>0.q;
                                  if ($$.q.addr == Q_PORT) {
-                                       bpf_set_error(cstate, "'port' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'port' qualifier applied to IPv6 address");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PORTRANGE) {
-                                       bpf_set_error(cstate, "'portrange' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'portrange' qualifier applied to IPv6 address");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTO) {
-                                       bpf_set_error(cstate, "'proto' modifier applied to 'ip6addr/prefixlen");
+                                       bpf_set_error(cstate, "'proto' qualifier applied to 'ip6addr/prefixlen");
                                        YYABORT;
                                  } else if ($$.q.addr == Q_PROTOCHAIN) {
-                                       bpf_set_error(cstate, "'protochain' modifier applied to IP address");
+                                       bpf_set_error(cstate, "'protochain' qualifier applied to IPv6 address");
                                        YYABORT;
                                  }
                                  CHECK_PTR_VAL(($$.b = gen_mcode6(cstate, $1, 128, $$.q)));
index b94a579902d9ca5e392ec89b6280232c6b5070ea..7330180681c428d6d8637d12f09ec0855f0eed95 100755 (executable)
@@ -11445,7 +11445,7 @@ my @reject_tests = (
                name => 'proto_1_2_3_4',
                DLT => 'RAW',
                expr => 'proto 1.2.3.4',
-               errstr => '\'proto\' modifier applied to IP address',
+               errstr => '\'proto\' qualifier applied to IPv4 address',
        },
        # In the tests below the hostname normally should not matter because the
        # lookup would be made not in the IPv4/IPv6 space, or not at all.  Still