summaryrefslogtreecommitdiff
path: root/print-pim.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2023-02-20 12:12:53 -0800
committerGuy Harris <gharris@sonic.net>2023-02-20 12:12:53 -0800
commit0dc32a024773968cb1ae00729758e61b7418564a (patch)
tree8e12ebe232a4dfc435bb0ddc29a3f5361eb5fe27 /print-pim.c
parent373a2ec94c46966343d4b648fae52e99f5c7b1d0 (diff)
downloadtcpdump-0dc32a024773968cb1ae00729758e61b7418564a.tar.gz
pim: use af.h values for the address family.
Use them in the case statement testing the address family from the packet, and use them, rather than AF_ values, to indicate the address family from the packet.
Diffstat (limited to 'print-pim.c')
-rw-r--r--print-pim.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/print-pim.c b/print-pim.c
index f2db8c76..ab097329 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -34,6 +34,7 @@
#include "ip.h"
#include "ip6.h"
#include "ipproto.h"
+#include "af.h"
#define PIMV1_TYPE_QUERY 0
#define PIMV1_TYPE_REGISTER 1
@@ -559,13 +560,12 @@ pimv2_addr_print(netdissect_options *ndo,
if (addr_len == 0) {
if (len < 2)
goto trunc;
- switch (GET_U_1(bp)) {
- case 1:
- af = AF_INET;
+ af = GET_U_1(bp);
+ switch (af) {
+ case AFNUM_INET:
addr_len = (u_int)sizeof(nd_ipv4);
break;
- case 2:
- af = AF_INET6;
+ case AFNUM_INET6:
addr_len = (u_int)sizeof(nd_ipv6);
break;
default:
@@ -577,10 +577,10 @@ pimv2_addr_print(netdissect_options *ndo,
} else {
switch (addr_len) {
case sizeof(nd_ipv4):
- af = AF_INET;
+ af = AFNUM_INET;
break;
case sizeof(nd_ipv6):
- af = AF_INET6;
+ af = AFNUM_INET6;
break;
default:
return -1;
@@ -596,11 +596,11 @@ pimv2_addr_print(netdissect_options *ndo,
if (len < addr_len)
goto trunc;
ND_TCHECK_LEN(bp, addr_len);
- if (af == AF_INET) {
+ if (af == AFNUM_INET) {
if (!silent)
ND_PRINT("%s", GET_IPADDR_STRING(bp));
}
- else if (af == AF_INET6) {
+ else if (af == AFNUM_INET6) {
if (!silent)
ND_PRINT("%s", GET_IP6ADDR_STRING(bp));
}
@@ -610,14 +610,14 @@ pimv2_addr_print(netdissect_options *ndo,
if (len < addr_len + 2)
goto trunc;
ND_TCHECK_LEN(bp, addr_len + 2);
- if (af == AF_INET) {
+ if (af == AFNUM_INET) {
if (!silent) {
ND_PRINT("%s", GET_IPADDR_STRING(bp + 2));
if (GET_U_1(bp + 1) != 32)
ND_PRINT("/%u", GET_U_1(bp + 1));
}
}
- else if (af == AF_INET6) {
+ else if (af == AFNUM_INET6) {
if (!silent) {
ND_PRINT("%s", GET_IP6ADDR_STRING(bp + 2));
if (GET_U_1(bp + 1) != 128)