+/* 5 is reserved */
+#define RIPCMD_TRIGREQ 6
+#define RIPCMD_TRIGRESP 7
+#define RIPCMD_TRIGACK 8
+#define RIPCMD_UPDREQ 9
+#define RIPCMD_UPDRESP 10
+#define RIPCMD_UPDACK 11
+
+static const struct tok rip_cmd_values[] = {
+ { RIPCMD_REQUEST, "Request" },
+ { RIPCMD_RESPONSE, "Response" },
+ { RIPCMD_TRACEON, "Trace on" },
+ { RIPCMD_TRACEOFF, "Trace off" },
+ { RIPCMD_TRIGREQ, "Triggered Request" },
+ { RIPCMD_TRIGRESP, "Triggered Response" },
+ { RIPCMD_TRIGACK, "Triggered Acknowledgement" },
+ { RIPCMD_UPDREQ, "Update Request" },
+ { RIPCMD_UPDRESP, "Update Response" },
+ { RIPCMD_UPDACK, "Update Acknowledge" },
+ { 0, NULL}
+};
+
+#define RIP_AUTHLEN 16
+#define RIP_ROUTELEN 20
+
+/*
+ * First 4 bytes of all RIPv1/RIPv2 entries.
+ */
+struct rip_entry_header {
+ nd_uint16_t rip_family;
+ nd_uint16_t rip_tag;
+};
+
+/*
+ * RFC 1058 entry.
+ *
+ * 0 1 2 3 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Address Family Identifier (2) | must be zero (2) |
+ * +-------------------------------+-------------------------------+
+ * | IP Address (4) |
+ * +---------------------------------------------------------------+
+ * | must be zero (4) |
+ * +---------------------------------------------------------------+
+ * | must be zero (4) |
+ * +---------------------------------------------------------------+
+ * | Metric (4) |
+ * +---------------------------------------------------------------+
+ */
+struct rip_netinfo_v1 {
+ nd_uint16_t rip_family;
+ nd_byte rip_mbz1[2];
+ nd_ipv4 rip_dest;
+ nd_byte rip_mbz2[4];
+ nd_byte rip_mbz3[4];
+ nd_uint32_t rip_metric; /* cost of route */
+};
+
+
+/*
+ * RFC 2453 route entry
+ *
+ * 0 1 2 3 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Address Family Identifier (2) | Route Tag (2) |
+ * +-------------------------------+-------------------------------+
+ * | IP Address (4) |
+ * +---------------------------------------------------------------+
+ * | Subnet Mask (4) |
+ * +---------------------------------------------------------------+
+ * | Next Hop (4) |
+ * +---------------------------------------------------------------+
+ * | Metric (4) |
+ * +---------------------------------------------------------------+
+ *
+ */
+
+struct rip_netinfo_v2 {
+ nd_uint16_t rip_family;
+ nd_uint16_t rip_tag;
+ nd_ipv4 rip_dest;
+ nd_uint32_t rip_dest_mask;
+ nd_ipv4 rip_router;
+ nd_uint32_t rip_metric; /* cost of route */
+};
+
+/*
+ * RFC 2453 authentication entry
+ *
+ * 0 1 2 3 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | 0xFFFF | Authentication Type (2) |
+ * +-------------------------------+-------------------------------+
+ * - Authentication (16) -
+ * +---------------------------------------------------------------+
+ */
+
+struct rip_auth_v2 {
+ nd_uint16_t rip_family;
+ nd_uint16_t rip_tag;
+ nd_byte rip_auth[16];
+};
+
+/*
+ * RFC 4822 Cryptographic Authentication entry.
+ *
+ * 0 1 2 3 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | RIPv2 Packet Length | Key ID | Auth Data Len |
+ * +---------------+---------------+---------------+---------------+
+ * | Sequence Number (non-decreasing) |
+ * +---------------+---------------+---------------+---------------+
+ * | reserved must be zero |
+ * +---------------+---------------+---------------+---------------+
+ * | reserved must be zero |
+ * +---------------+---------------+---------------+---------------+
+ */
+struct rip_auth_crypto_v2 {
+ nd_uint16_t rip_packet_len;
+ nd_uint8_t rip_key_id;
+ nd_uint8_t rip_auth_data_len;
+ nd_uint32_t rip_seq_num;
+ nd_byte rip_mbz1[4];
+ nd_byte rip_mbz2[4];
+};