]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Rename the BSD_AFNUM_ values to BSD_AF_.
authorGuy Harris <[email protected]>
Mon, 20 Feb 2023 21:30:16 +0000 (13:30 -0800)
committerGuy Harris <[email protected]>
Mon, 20 Feb 2023 21:30:16 +0000 (13:30 -0800)
They correspond to OS socket API AF_ values, which are distinct from
address family numbers in the IANA registry at
https://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml

af.c
af.h
print-enc.c
print-null.c
print-pflog.c
print-rip.c

diff --git a/af.c b/af.c
index 1153f102b407fc3dbe8627ca4b81e43c4b0dc521..ea146014b0d98c49e7cc920d2f9052577ea1873e 100644 (file)
--- a/af.c
+++ b/af.c
@@ -46,13 +46,13 @@ const struct tok af_values[] = {
 };
 
 const struct tok bsd_af_values[] = {
-    { BSD_AFNUM_INET, "IPv4" },
-    { BSD_AFNUM_NS, "NS" },
-    { BSD_AFNUM_ISO, "ISO" },
-    { BSD_AFNUM_APPLETALK, "Appletalk" },
-    { BSD_AFNUM_IPX, "IPX" },
-    { BSD_AFNUM_INET6_BSD, "IPv6" },
-    { BSD_AFNUM_INET6_FREEBSD, "IPv6" },
-    { BSD_AFNUM_INET6_DARWIN, "IPv6" },
+    { BSD_AF_INET, "IPv4" },
+    { BSD_AF_NS, "NS" },
+    { BSD_AF_ISO, "ISO" },
+    { BSD_AF_APPLETALK, "Appletalk" },
+    { BSD_AF_IPX, "IPX" },
+    { BSD_AF_INET6_BSD, "IPv6" },
+    { BSD_AF_INET6_FREEBSD, "IPv6" },
+    { BSD_AF_INET6_DARWIN, "IPv6" },
     { 0, NULL}
 };
diff --git a/af.h b/af.h
index b9fec8e635ad299e382a334edfa563af494d8009..3c0c7908918e9cd01a8924b72b80daf3785160fc 100644 (file)
--- a/af.h
+++ b/af.h
@@ -45,11 +45,11 @@ extern const struct tok bsd_af_values[];
  * so, because we want to be able to read captures from all of the BSDs,
  * we check for all of them.
  */
-#define BSD_AFNUM_INET         2
-#define BSD_AFNUM_NS           6               /* XEROX NS protocols */
-#define BSD_AFNUM_ISO          7
-#define BSD_AFNUM_APPLETALK    16
-#define BSD_AFNUM_IPX          23
-#define BSD_AFNUM_INET6_BSD    24      /* NetBSD, OpenBSD, BSD/OS, Npcap */
-#define BSD_AFNUM_INET6_FREEBSD        28      /* FreeBSD */
-#define BSD_AFNUM_INET6_DARWIN 30      /* macOS, iOS, other Darwin-based OSes */
+#define BSD_AF_INET            2
+#define BSD_AF_NS              6       /* XEROX NS protocols */
+#define BSD_AF_ISO             7
+#define BSD_AF_APPLETALK       16
+#define BSD_AF_IPX             23
+#define BSD_AF_INET6_BSD       24      /* NetBSD, OpenBSD, BSD/OS, Npcap */
+#define BSD_AF_INET6_FREEBSD   28      /* FreeBSD */
+#define BSD_AF_INET6_DARWIN    30      /* macOS, iOS, other Darwin-based OSes */
index 928b02c8870e0eb83534b2d71db45b987edbbc4c..8b148fabb486f6732a6c009a492cdcaaf44a641b 100644 (file)
@@ -146,12 +146,12 @@ enc_if_print(netdissect_options *ndo,
        p += ENC_HDRLEN;
 
        switch (af) {
-       case BSD_AFNUM_INET:
+       case BSD_AF_INET:
                ip_print(ndo, p, length);
                break;
-       case BSD_AFNUM_INET6_BSD:
-       case BSD_AFNUM_INET6_FREEBSD:
-       case BSD_AFNUM_INET6_DARWIN:
+       case BSD_AF_INET6_BSD:
+       case BSD_AF_INET6_FREEBSD:
+       case BSD_AF_INET6_DARWIN:
                ip6_print(ndo, p, length);
                break;
        }
index a1b03f86aae62f912877bc9be149cef823b4dfb7..bf03b422569d7de255f811c611969f7aad0da3fe 100644 (file)
@@ -106,25 +106,25 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
 
        switch (family) {
 
-       case BSD_AFNUM_INET:
+       case BSD_AF_INET:
                ip_print(ndo, p, length);
                break;
 
-       case BSD_AFNUM_INET6_BSD:
-       case BSD_AFNUM_INET6_FREEBSD:
-       case BSD_AFNUM_INET6_DARWIN:
+       case BSD_AF_INET6_BSD:
+       case BSD_AF_INET6_FREEBSD:
+       case BSD_AF_INET6_DARWIN:
                ip6_print(ndo, p, length);
                break;
 
-       case BSD_AFNUM_ISO:
+       case BSD_AF_ISO:
                isoclns_print(ndo, p, length);
                break;
 
-       case BSD_AFNUM_APPLETALK:
+       case BSD_AF_APPLETALK:
                atalk_print(ndo, p, length);
                break;
 
-       case BSD_AFNUM_IPX:
+       case BSD_AF_IPX:
                ipx_print(ndo, p, length);
                break;
 
index 1cffbf6bf8308e658d92b1532d4e17731d1e23d8..f7772af62c20d624746577025ce02d92206d421d 100644 (file)
@@ -176,7 +176,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                 *
                 * Hopefully, there isn't.
                 */
-               case BSD_AFNUM_INET:
+               case BSD_AF_INET:
                        ip_print(ndo, p, length);
                        break;
 
@@ -184,9 +184,9 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                 * Try all AF_INET6 values for all systems with pflog,
                 * including Darwin.
                 */
-               case BSD_AFNUM_INET6_BSD:
-               case BSD_AFNUM_INET6_FREEBSD:
-               case BSD_AFNUM_INET6_DARWIN:
+               case BSD_AF_INET6_BSD:
+               case BSD_AF_INET6_FREEBSD:
+               case BSD_AF_INET6_DARWIN:
                        ip6_print(ndo, p, length);
                        break;
 
index 3567255107c83ba08a07559ce1fba030b30a752b..9e81bb53593199a17e1e5a30659f0ea7e57439c0 100644 (file)
@@ -198,7 +198,7 @@ rip_entry_print_v1(netdissect_options *ndo, const u_char *p,
        ND_ICHECKMSG_U("remaining data length", remaining, <, RIP_ROUTELEN);
        ND_TCHECK_SIZE(ni);
        family = GET_BE_U_2(ni->rip_family);
-       if (family != BSD_AFNUM_INET && family != 0) {
+       if (family != BSD_AF_INET && family != 0) {
                ND_PRINT("\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family));
                print_unknown_data(ndo, p + sizeof(*eh), "\n\t  ", RIP_ROUTELEN - sizeof(*eh));
                return (RIP_ROUTELEN);
@@ -215,7 +215,7 @@ rip_entry_print_v1(netdissect_options *ndo, const u_char *p,
                         GET_IPADDR_STRING(ni->rip_dest),
                         GET_BE_U_4(ni->rip_metric));
                return (RIP_ROUTELEN);
-       } /* BSD_AFNUM_INET */
+       } /* BSD_AF_INET */
        ND_PRINT("\n\t  %s, metric: %u",
                 GET_IPADDR_STRING(ni->rip_dest),
                 GET_BE_U_4(ni->rip_metric));
@@ -268,10 +268,10 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p,
                        print_unknown_data(ndo, p, "\n\t  ", remaining);
                        return (sizeof(*eh) + remaining); /* we don't know how long this is, so we go to the packet end */
                }
-       } else if (family != BSD_AFNUM_INET && family != 0) {
+       } else if (family != BSD_AF_INET && family != 0) {
                ND_PRINT("\n\t  AFI %s", tok2str(bsd_af_values, "Unknown (%u)", family));
                print_unknown_data(ndo, p + sizeof(*eh), "\n\t  ", RIP_ROUTELEN - sizeof(*eh));
-       } else { /* BSD_AFNUM_INET or AFI 0 */
+       } else { /* BSD_AF_INET or AFI 0 */
                ni = (const struct rip_netinfo_v2 *)p;
                ND_ICHECKMSG_ZU("remaining data length", remaining, <,
                                sizeof(*ni));