Skip to content

Commit

Permalink
Merge pull request #6 from malsbat/get_mptcp_option
Browse files Browse the repository at this point in the history
Replace get_tcp_option with get_mptcp_option
  • Loading branch information
dcaratti authored Jun 18, 2020
2 parents 539e273 + a254118 commit dd02787
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions gtests/net/packetdrill/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static int extract_and_set_kernel_key(
{

struct tcp_option* mpcap_opt =
get_tcp_option(live_packet, TCPOPT_MPTCP);
get_mptcp_option(live_packet, MP_CAPABLE_SUBTYPE);

if(!mpcap_opt)
return STATUS_ERR;
Expand Down Expand Up @@ -717,7 +717,7 @@ static int mp_join_syn_ack(struct packet *packet_to_modify,
struct mp_subflow *subflow =
find_subflow_matching_outbound_packet(live_packet);
struct tcp_option *live_mp_join =
get_tcp_option(live_packet, TCPOPT_MPTCP);
get_mptcp_option(live_packet, MP_JOIN_SUBTYPE);

if(!subflow || !live_mp_join)
return STATUS_ERR;
Expand Down Expand Up @@ -783,7 +783,7 @@ int mptcp_subtype_mp_join(struct packet *packet_to_modify,
struct mp_subflow *subflow =
find_subflow_matching_outbound_packet(live_packet);
struct tcp_option *live_mp_join =
get_tcp_option(live_packet, TCPOPT_MPTCP);
get_mptcp_option(live_packet, MP_JOIN_SUBTYPE);

if(!subflow || !live_mp_join)
return STATUS_ERR;
Expand Down Expand Up @@ -1098,7 +1098,7 @@ int dss_inbound_parser(struct packet *packet_to_modify,
if(dss_opt_script->data.dss.flag_F)
tcp_payload_length++;

struct tcp_option* dss_opt_live = get_tcp_option(live_packet, TCPOPT_MPTCP);
struct tcp_option* dss_opt_live = get_mptcp_option(live_packet, DSS_SUBTYPE);
if(!dss_opt_live)
return STATUS_ERR;
// if a packet is going from packetdrill with DSN and DACK to kernel
Expand Down Expand Up @@ -1836,7 +1836,7 @@ int mptcp_subtype_mp_fail(struct packet *packet_to_modify,
struct tcp_option *dss_opt_script,
unsigned direction)
{
struct tcp_option* dss_opt_live = get_tcp_option(live_packet, TCPOPT_MPTCP);
struct tcp_option* dss_opt_live = get_mptcp_option(live_packet, DSS_SUBTYPE);
if(!dss_opt_live)
return STATUS_ERR;

Expand Down
3 changes: 2 additions & 1 deletion gtests/net/packetdrill/tcp_options_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ extern struct tcp_option *get_mptcp_option(struct packet *packet, u8 subtype){
struct tcp_options_iterator tcp_opt_iter;
struct tcp_option *tcp_opt = tcp_options_begin(packet, &tcp_opt_iter);

while(tcp_opt != NULL && tcp_opt->data.mp_capable.subtype!=subtype){
while(tcp_opt != NULL && (tcp_opt->kind != TCPOPT_MPTCP ||
tcp_opt->data.mp_capable.subtype != subtype)){
tcp_opt = tcp_options_next(&tcp_opt_iter, NULL);
}
return tcp_opt;
Expand Down

0 comments on commit dd02787

Please sign in to comment.