I copied the defines from the sys/net bfd code to use in tcpdump and
noticed that I wasn't seeing any poll bits from the remote side, even
though tcpdump on the remote side showed it was sending them. Turns out
the bitmask for state and flags is a bit off. Diff below fixes them to
match what's in the RFC (and the comment a bit higher in the file)

Mitchell


diff --git sys/net/bfd.c sys/net/bfd.c
index 0d2ec8af512..db8d571f35b 100644
--- sys/net/bfd.c
+++ sys/net/bfd.c
@@ -90,8 +90,8 @@ struct bfd_auth_header {
 #define BFD_VERSION            1       /* RFC 5880 Page 6 */
 #define BFD_VER(x)             (((x) & 0xe0) >> 5)
 #define BFD_DIAG(x)            ((x) & 0x1f)
-#define BFD_STATE(x)           (((x) & 0xf0) >> 6)
-#define BFD_FLAGS(x)           ((x) & 0x0f)
+#define BFD_STATE(x)           (((x) & 0xc0) >> 6)
+#define BFD_FLAGS(x)           ((x) & 0x3f)
 #define BFD_HDRLEN             24      /* RFC 5880 Page 37 */
 #define BFD_AUTH_SIMPLE_LEN    16 + 3  /* RFC 5880 Page 10 */
 #define BFD_AUTH_MD5_LEN       24      /* RFC 5880 Page 11 */

Reply via email to