]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: show local/rx values in RA mismatch debugs
authorTrey Aspelund <taspelund@nvidia.com>
Fri, 30 Sep 2022 19:58:31 +0000 (19:58 +0000)
committerTrey Aspelund <taspelund@nvidia.com>
Tue, 4 Oct 2022 15:20:44 +0000 (15:20 +0000)
When we process a received Router Advertisement we have some logic in
place to detect and log mismatches in a handful of flags/values.
However, these logs do not include what the actual values are, which
means it's up to the operator to grab a packet capture and compare that
against the local configuration...
So let's make life a little easier by including those in the log itself.

Before:
```
2022/09/30 20:37:16 ZEBRA: [KV2V1-7GM7G][EC 4043309149] enp1s0(2): Rx RA - our AdvCurHopLimit doesn't agree with fe80::5054:ff:feca:b085
2022/09/30 20:37:16 ZEBRA: [KS0BP-4GR8K][EC 4043309149] enp1s0(2): Rx RA - our AdvManagedFlag doesn't agree with fe80::5054:ff:feca:b085
2022/09/30 20:37:16 ZEBRA: [RE4EC-VYEJ2][EC 4043309149] enp1s0(2): Rx RA - our AdvOtherConfigFlag doesn't agree with fe80::5054:ff:feca:b085
2022/09/30 20:37:16 ZEBRA: [X6794-9MW18][EC 4043309149] enp1s0(2): Rx RA - our AdvReachableTime doesn't agree with fe80::5054:ff:feca:b085
2022/09/30 20:37:16 ZEBRA: [S1KXC-H8F4W][EC 4043309149] enp1s0(2): Rx RA - our AdvRetransTimer doesn't agree with fe80::5054:ff:feca:b085
```

After:
```
Sep 30 20:45:18 ub20-2 zebra[47487]: [GSW5Z-V7DZN][EC 4043309149] enp1s0(2): Rx RA - our AdvCurHopLimit (14) doesn't agree with fe80::5054:ff:fe9a:e2ca (64)
Sep 30 20:45:18 ub20-2 zebra[47487]: [RHHTS-F96DR][EC 4043309149] enp1s0(2): Rx RA - our AdvManagedFlag (0) doesn't agree with fe80::5054:ff:fe9a:e2ca (1)
Sep 30 20:45:18 ub20-2 zebra[47487]: [MNBY3-FTN6W][EC 4043309149] enp1s0(2): Rx RA - our AdvOtherConfigFlag (0) doesn't agree with fe80::5054:ff:fe9a:e2ca (1)
Sep 30 20:45:18 ub20-2 zebra[47487]: [GG62B-XXWR0][EC 4043309149] enp1s0(2): Rx RA - our AdvReachableTime (20) doesn't agree with fe80::5054:ff:fe9a:e2ca (777)
Sep 30 20:45:18 ub20-2 zebra[47487]: [YG220-D6B4H][EC 4043309149] enp1s0(2): Rx RA - our AdvRetransTimer (13) doesn't agree with fe80::5054:ff:fe9a:e2ca (0)
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
zebra/rtadv.c

index 93590a2f166786badea22a989b9a9d172b45a4d7..8059a545e4f3ae6e72e2dde2023bd246d0624d9d 100644 (file)
@@ -664,8 +664,9 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
             zif->rtadv.lastadvcurhoplimit.tv_sec == 0)) {
                flog_warn(
                        EC_ZEBRA_RA_PARAM_MISMATCH,
-                       "%s(%u): Rx RA - our AdvCurHopLimit doesn't agree with %s",
-                       ifp->name, ifp->ifindex, addr_str);
+                       "%s(%u): Rx RA - our AdvCurHopLimit (%u) doesn't agree with %s (%u)",
+                       ifp->name, ifp->ifindex, zif->rtadv.AdvCurHopLimit,
+                       addr_str, radvert->nd_ra_curhoplimit);
                monotime(&zif->rtadv.lastadvcurhoplimit);
        }
 
@@ -676,8 +677,11 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
             zif->rtadv.lastadvmanagedflag.tv_sec == 0)) {
                flog_warn(
                        EC_ZEBRA_RA_PARAM_MISMATCH,
-                       "%s(%u): Rx RA - our AdvManagedFlag doesn't agree with %s",
-                       ifp->name, ifp->ifindex, addr_str);
+                       "%s(%u): Rx RA - our AdvManagedFlag (%u) doesn't agree with %s (%u)",
+                       ifp->name, ifp->ifindex, zif->rtadv.AdvManagedFlag,
+                       addr_str,
+                       !!CHECK_FLAG(radvert->nd_ra_flags_reserved,
+                                    ND_RA_FLAG_MANAGED));
                monotime(&zif->rtadv.lastadvmanagedflag);
        }
 
@@ -688,8 +692,11 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
             zif->rtadv.lastadvotherconfigflag.tv_sec == 0)) {
                flog_warn(
                        EC_ZEBRA_RA_PARAM_MISMATCH,
-                       "%s(%u): Rx RA - our AdvOtherConfigFlag doesn't agree with %s",
-                       ifp->name, ifp->ifindex, addr_str);
+                       "%s(%u): Rx RA - our AdvOtherConfigFlag (%u) doesn't agree with %s (%u)",
+                       ifp->name, ifp->ifindex, zif->rtadv.AdvOtherConfigFlag,
+                       addr_str,
+                       !!CHECK_FLAG(radvert->nd_ra_flags_reserved,
+                                    ND_RA_FLAG_OTHER));
                monotime(&zif->rtadv.lastadvotherconfigflag);
        }
 
@@ -700,8 +707,9 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
             zif->rtadv.lastadvreachabletime.tv_sec == 0)) {
                flog_warn(
                        EC_ZEBRA_RA_PARAM_MISMATCH,
-                       "%s(%u): Rx RA - our AdvReachableTime doesn't agree with %s",
-                       ifp->name, ifp->ifindex, addr_str);
+                       "%s(%u): Rx RA - our AdvReachableTime (%u) doesn't agree with %s (%u)",
+                       ifp->name, ifp->ifindex, zif->rtadv.AdvReachableTime,
+                       addr_str, ntohl(radvert->nd_ra_reachable));
                monotime(&zif->rtadv.lastadvreachabletime);
        }
 
@@ -712,8 +720,9 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len,
             zif->rtadv.lastadvretranstimer.tv_sec == 0)) {
                flog_warn(
                        EC_ZEBRA_RA_PARAM_MISMATCH,
-                       "%s(%u): Rx RA - our AdvRetransTimer doesn't agree with %s",
-                       ifp->name, ifp->ifindex, addr_str);
+                       "%s(%u): Rx RA - our AdvRetransTimer (%u) doesn't agree with %s (%u)",
+                       ifp->name, ifp->ifindex, zif->rtadv.AdvRetransTimer,
+                       addr_str, ntohl(radvert->nd_ra_retransmit));
                monotime(&zif->rtadv.lastadvretranstimer);
        }