hdr_stg = bpf_sk_storage_get(&hdr_stg_map, skops->sk, NULL, 0); if (!hdr_stg) return -1;
return !!hdr_stg->resend_syn;
}
staticint nodata_opt_len(struct bpf_sock_ops *skops)
{ int resend;
resend = resend_in_ack(skops); if (resend < 0)
RET_CG_ERR(0);
if (resend) return syn_opt_len(skops);
return CG_OK;
}
staticint write_nodata_opt(struct bpf_sock_ops *skops)
{ int resend;
resend = resend_in_ack(skops); if (resend < 0)
RET_CG_ERR(0);
if (resend) return write_syn_opt(skops);
return CG_OK;
}
staticint data_opt_len(struct bpf_sock_ops *skops)
{ /* Same as the nodata version. Mostly to show * an example usage on skops->skb_len.
*/ return nodata_opt_len(skops);
}
if (init_stg.resend_syn) /* Don't clear the write_hdr cb now because * the ACK may get lost and retransmit may * be needed. * * PARSE_ALL_HDR cb flag is set to learn if this * resend_syn option has received by the peer. * * The header option will be resent until a valid * packet is received at handle_parse_hdr() * and all hdr cb flags will be cleared in * handle_parse_hdr().
*/
set_parse_all_hdr_cb_flags(skops); elseif (!active_fin_out.flags) /* No options will be written from now */
clear_hdr_cb_flags(skops);
if (active_syn_out.max_delack_ms) {
err = set_delack_max(skops, active_syn_out.max_delack_ms); if (err)
RET_CG_ERR(err);
}
if (active_estab_in.max_delack_ms) {
err = set_rto_min(skops, active_estab_in.max_delack_ms); if (err)
RET_CG_ERR(err);
}
err = load_option(skops, &passive_estab_in, true); if (err == -ENOENT) { /* saved_syn is not found. It was in syncookie mode. * We have asked the active side to resend the options * in ACK, so try to find the bpf_test_option from ACK now.
*/
err = load_option(skops, &passive_estab_in, false);
init_stg.syncookie = true;
}
/* ENOMSG: The bpf_test_option is not found which is fine. * Bail out now for all other errors.
*/ if (err && err != -ENOMSG)
RET_CG_ERR(err);
th = skops->skb_data; if (th + 1 > skops->skb_data_end)
RET_CG_ERR(0);
if (th->syn) { /* Fastopen */
/* Cannot clear cb_flags to stop write_hdr cb. * synack is not sent yet for fast open. * Even it was, the synack may need to be retransmitted. * * PARSE_ALL_HDR cb flag is set to learn * if synack has reached the peer. * All cb_flags will be cleared in handle_parse_hdr().
*/
set_parse_all_hdr_cb_flags(skops);
init_stg.fastopen = true;
} elseif (!passive_fin_out.flags) { /* No options will be written from now */
clear_hdr_cb_flags(skops);
}
if (!skops->sk ||
!bpf_sk_storage_get(&hdr_stg_map, skops->sk, &init_stg,
BPF_SK_STORAGE_GET_F_CREATE))
RET_CG_ERR(0);
if (passive_synack_out.max_delack_ms) {
err = set_delack_max(skops, passive_synack_out.max_delack_ms); if (err)
RET_CG_ERR(err);
}
if (passive_estab_in.max_delack_ms) {
err = set_rto_min(skops, passive_estab_in.max_delack_ms); if (err)
RET_CG_ERR(err);
}
th = skops->skb_data; if (th + 1 > skops->skb_data_end)
RET_CG_ERR(0);
hdr_stg = bpf_sk_storage_get(&hdr_stg_map, skops->sk, NULL, 0); if (!hdr_stg)
RET_CG_ERR(0);
if (hdr_stg->resend_syn || hdr_stg->fastopen) /* The PARSE_ALL_HDR cb flag was turned on * to ensure that the previously written * options have reached the peer. * Those previously written option includes: * - Active side: resend_syn in ACK during syncookie * or * - Passive side: SYNACK during fastopen * * A valid packet has been received here after * the 3WHS, so the PARSE_ALL_HDR cb flag * can be cleared now.
*/
clear_parse_all_hdr_cb_flags(skops);
if (hdr_stg->resend_syn && !active_fin_out.flags) /* Active side resent the syn option in ACK * because the server was in syncookie mode. * A valid packet has been received, so * clear header cb flags if there is no * more option to send.
*/
clear_hdr_cb_flags(skops);
if (hdr_stg->fastopen && !passive_fin_out.flags) /* Passive side was in fastopen. * A valid packet has been received, so * the SYNACK has reached the peer. * Clear header cb flags if there is no more * option to send.
*/
clear_hdr_cb_flags(skops);
if (th->fin) { struct bpf_test_option *fin_opt; int err;
if (hdr_stg->active)
fin_opt = &active_fin_in; else
fin_opt = &passive_fin_in;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.