+ uint8_t auth_type, auth_len;
+ int i;
+
+ pptr += sizeof (struct bfd_header_t);
+ bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
+ ND_TCHECK_SIZE(bfd_auth_header);
+ auth_type = GET_U_1(bfd_auth_header->auth_type);
+ auth_len = GET_U_1(bfd_auth_header->auth_len);
+ ND_PRINT("\n\tAuthentication: %s (%u), length: %u",
+ tok2str(bfd_v1_authentication_values,"Unknown",auth_type),
+ auth_type, auth_len);
+ pptr += 2;
+ ND_PRINT("\n\t Auth Key ID: %u", GET_U_1(pptr));
+
+ switch(auth_type) {
+ case AUTH_PASSWORD:
+/*
+ * Simple Password Authentication Section Format
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Type | Auth Len | Auth Key ID | Password... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | ... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ if (auth_len < AUTH_PASSWORD_FIELD_MIN_LEN ||
+ auth_len > AUTH_PASSWORD_FIELD_MAX_LEN) {
+ ND_PRINT("[invalid length %u]",
+ auth_len);
+ break;
+ }
+ pptr++;
+ ND_PRINT(", Password: ");
+ /* the length is equal to the password length plus three */
+ nd_printjn(ndo, pptr, auth_len - 3);
+ break;
+ case AUTH_MD5:
+ case AUTH_MET_MD5:
+/*
+ * Keyed MD5 and Meticulous Keyed MD5 Authentication Section Format
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Type | Auth Len | Auth Key ID | Reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Key/Digest... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | ... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ if (auth_len != AUTH_MD5_FIELD_LEN) {
+ ND_PRINT("[invalid length %u]",
+ auth_len);
+ break;
+ }
+ pptr += 2;
+ ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr));
+ pptr += 4;
+ ND_TCHECK_LEN(pptr, AUTH_MD5_HASH_LEN);
+ ND_PRINT("\n\t Digest: ");
+ for(i = 0; i < AUTH_MD5_HASH_LEN; i++)
+ ND_PRINT("%02x", GET_U_1(pptr + i));
+ break;
+ case AUTH_SHA1:
+ case AUTH_MET_SHA1:
+/*
+ * Keyed SHA1 and Meticulous Keyed SHA1 Authentication Section Format
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Type | Auth Len | Auth Key ID | Reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Key/Hash... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | ... |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ if (auth_len != AUTH_SHA1_FIELD_LEN) {
+ ND_PRINT("[invalid length %u]",
+ auth_len);
+ break;
+ }
+ pptr += 2;
+ ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr));
+ pptr += 4;
+ ND_TCHECK_LEN(pptr, AUTH_SHA1_HASH_LEN);
+ ND_PRINT("\n\t Hash: ");
+ for(i = 0; i < AUTH_SHA1_HASH_LEN; i++)
+ ND_PRINT("%02x", GET_U_1(pptr + i));
+ break;