+#define MPTCP_SUB_CAPABLE 0x0
+#define MPTCP_SUB_JOIN 0x1
+#define MPTCP_SUB_DSS 0x2
+#define MPTCP_SUB_ADD_ADDR 0x3
+#define MPTCP_SUB_REMOVE_ADDR 0x4
+#define MPTCP_SUB_PRIO 0x5
+#define MPTCP_SUB_FAIL 0x6
+#define MPTCP_SUB_FCLOSE 0x7
+#define MPTCP_SUB_TCPRST 0x8
+
+struct mptcp_option {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_etc; /* subtype upper 4 bits, other stuff lower 4 bits */
+};
+
+#define MPTCP_OPT_SUBTYPE(sub_etc) (((sub_etc) >> 4) & 0xF)
+
+#define MP_CAPABLE_A 0x80
+
+static const struct tok mp_capable_flags[] = {
+ { MP_CAPABLE_A, "A" },
+ { 0x40, "B" },
+ { 0x20, "C" },
+ { 0x10, "D" },
+ { 0x08, "E" },
+ { 0x04, "F" },
+ { 0x02, "G" },
+ { 0x01, "H" },
+ { 0, NULL }
+};
+
+struct mp_capable {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_ver;
+ nd_uint8_t flags;
+ nd_uint64_t sender_key;
+ nd_uint64_t receiver_key;
+ nd_uint16_t data_len;
+};
+
+#define MP_CAPABLE_OPT_VERSION(sub_ver) (((sub_ver) >> 0) & 0xF)
+
+struct mp_join {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_b;
+ nd_uint8_t addr_id;
+ union {
+ struct {
+ nd_uint32_t token;
+ nd_uint32_t nonce;
+ } syn;
+ struct {
+ nd_uint64_t mac;
+ nd_uint32_t nonce;
+ } synack;
+ struct {
+ nd_byte mac[20];
+ } ack;
+ } u;
+};
+
+#define MP_JOIN_B 0x01
+
+struct mp_dss {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub;
+ nd_uint8_t flags;
+};
+
+#define MP_DSS_F 0x10
+#define MP_DSS_m 0x08
+#define MP_DSS_M 0x04
+#define MP_DSS_a 0x02
+#define MP_DSS_A 0x01
+
+static const struct tok mptcp_addr_subecho_bits[] = {
+ { 0x6, "v0-ip6" },
+ { 0x4, "v0-ip4" },
+ { 0x1, "v1-echo" },
+ { 0x0, "v1" },
+ { 0, NULL }
+};
+
+struct mp_add_addr {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_echo;
+ nd_uint8_t addr_id;
+ union {
+ struct {
+ nd_ipv4 addr;
+ nd_uint16_t port;
+ nd_uint64_t mac;
+ } v4;
+ struct {
+ nd_ipv4 addr;
+ nd_uint64_t mac;
+ } v4np;
+ struct {
+ nd_ipv6 addr;
+ nd_uint16_t port;
+ nd_uint64_t mac;
+ } v6;
+ struct {
+ nd_ipv6 addr;
+ nd_uint64_t mac;
+ } v6np;
+ } u;
+};
+
+struct mp_remove_addr {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub;
+ /* list of addr_id */
+ nd_uint8_t addrs_id[1];
+};
+
+struct mp_fail {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub;
+ nd_uint8_t resv;
+ nd_uint64_t data_seq;
+};
+
+struct mp_close {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub;
+ nd_uint8_t rsv;
+ nd_byte key[8];
+};
+
+struct mp_prio {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_b;
+ nd_uint8_t addr_id;
+};
+
+#define MP_PRIO_B 0x01
+
+static const struct tok mp_tcprst_flags[] = {
+ { 0x08, "U" },
+ { 0x04, "V" },
+ { 0x02, "W" },
+ { 0x01, "T" },
+ { 0, NULL }
+};
+
+static const struct tok mp_tcprst_reasons[] = {
+ { 0x06, "Middlebox interference" },
+ { 0x05, "Unacceptable performance" },
+ { 0x04, "Too much outstanding data" },
+ { 0x03, "Administratively prohibited" },
+ { 0x02, "Lack of resources" },
+ { 0x01, "MPTCP-specific error" },
+ { 0x00, "Unspecified error" },
+ { 0, NULL }
+};
+
+struct mp_tcprst {
+ nd_uint8_t kind;
+ nd_uint8_t len;
+ nd_uint8_t sub_b;
+ nd_uint8_t reason;
+};
+
+static int
+dummy_print(netdissect_options *ndo _U_,
+ const u_char *opt _U_, u_int opt_len _U_, u_char flags _U_)