X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7b2c5a11a7bc236d72b440c4db5263edb23b4880..47b02443f099fc93a7c69041d30bf6f6be552ece:/print-mptcp.c diff --git a/print-mptcp.c b/print-mptcp.c index 947ffc4f..e757ea48 100644 --- a/print-mptcp.c +++ b/print-mptcp.c @@ -32,13 +32,17 @@ * SUCH DAMAGE. */ +/* \summary: Multipath TCP (MPTCP) printer */ + +/* specification: RFC 6824 */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" #include "addrtoname.h" @@ -172,7 +176,7 @@ static int mp_capable_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags) { - struct mp_capable *mpc = (struct mp_capable *) opt; + const struct mp_capable *mpc = (const struct mp_capable *) opt; if (!(opt_len == 12 && flags & TH_SYN) && !(opt_len == 20 && (flags & (TH_SYN | TH_ACK)) == TH_ACK)) @@ -196,7 +200,7 @@ static int mp_join_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags) { - struct mp_join *mpj = (struct mp_join *) opt; + const struct mp_join *mpj = (const struct mp_join *) opt; if (!(opt_len == 12 && flags & TH_SYN) && !(opt_len == 16 && (flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK)) && @@ -232,7 +236,7 @@ mp_join_print(netdissect_options *ndo, return 1; } -static u_int mp_dss_len(struct mp_dss *m, int csum) +static u_int mp_dss_len(const struct mp_dss *m, int csum) { u_int len; @@ -264,7 +268,7 @@ static int mp_dss_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags) { - struct mp_dss *mdss = (struct mp_dss *) opt; + const struct mp_dss *mdss = (const struct mp_dss *) opt; if ((opt_len != mp_dss_len(mdss, 1) && opt_len != mp_dss_len(mdss, 0)) || flags & TH_SYN) @@ -309,7 +313,7 @@ static int add_addr_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags _U_) { - struct mp_add_addr *add_addr = (struct mp_add_addr *) opt; + const struct mp_add_addr *add_addr = (const struct mp_add_addr *) opt; u_int ipver = MP_ADD_ADDR_IPVER(add_addr->sub_ipver); if (!((opt_len == 8 || opt_len == 10) && ipver == 4) && @@ -324,9 +328,7 @@ add_addr_print(netdissect_options *ndo, ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v4.port))); break; case 6: -#ifdef INET6 ND_PRINT((ndo, " %s", ip6addr_string(ndo, add_addr->u.v6.addr))); -#endif if (opt_len == 22) ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v6.port))); break; @@ -341,8 +343,8 @@ static int remove_addr_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags _U_) { - struct mp_remove_addr *remove_addr = (struct mp_remove_addr *) opt; - uint8_t *addr_id = &remove_addr->addrs_id; + const struct mp_remove_addr *remove_addr = (const struct mp_remove_addr *) opt; + const uint8_t *addr_id = &remove_addr->addrs_id; if (opt_len < 4) return 0; @@ -358,7 +360,7 @@ static int mp_prio_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags _U_) { - struct mp_prio *mpp = (struct mp_prio *) opt; + const struct mp_prio *mpp = (const struct mp_prio *) opt; if (opt_len != 3 && opt_len != 4) return 0; @@ -414,13 +416,13 @@ int mptcp_print(netdissect_options *ndo, const u_char *cp, u_int len, u_char flags) { - struct mptcp_option *opt; + const struct mptcp_option *opt; u_int subtype; if (len < 3) return 0; - opt = (struct mptcp_option *) cp; + opt = (const struct mptcp_option *) cp; subtype = min(MPTCP_OPT_SUBTYPE(opt->sub_etc), MPTCP_SUB_FCLOSE + 1); ND_PRINT((ndo, " %s", mptcp_options[subtype].name));