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 *anexampleusageonskops->skb_len.
*/ return nodata_opt_len(skops);
}
if (init_stg.resend_syn) /* Don't clear the write_hdr cb now because *theACKmaygetlostandretransmitmay *beneeded. * *PARSE_ALL_HDRcbflagissettolearnifthis *resend_synoptionhasreceivedbythepeer. * *Theheaderoptionwillberesentuntilavalid *packetisreceivedathandle_parse_hdr() *andallhdrcbflagswillbeclearedin *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. *Wehaveaskedtheactivesidetoresendtheoptions *inACK,sotrytofindthebpf_test_optionfromACKnow.
*/
err = load_option(skops, &passive_estab_in, false);
init_stg.syncookie = true;
}
/* ENOMSG: The bpf_test_option is not found which is fine. *Bailoutnowforallothererrors.
*/ 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. *synackisnotsentyetforfastopen. *Evenitwas,thesynackmayneedtoberetransmitted. * *PARSE_ALL_HDRcbflagissettolearn *ifsynackhasreachedthepeer. *Allcb_flagswillbeclearedinhandle_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 *toensurethatthepreviouslywritten *optionshavereachedthepeer. *Thosepreviouslywrittenoptionincludes: *-Activeside:resend_syninACKduringsyncookie *or *-Passiveside:SYNACKduringfastopen * *Avalidpackethasbeenreceivedhereafter *the3WHS,sothePARSE_ALL_HDRcbflag *canbeclearednow.
*/
clear_parse_all_hdr_cb_flags(skops);
if (hdr_stg->resend_syn && !active_fin_out.flags) /* Active side resent the syn option in ACK *becausetheserverwasinsyncookiemode. *Avalidpackethasbeenreceived,so *clearheadercbflagsifthereisno *moreoptiontosend.
*/
clear_hdr_cb_flags(skops);
if (hdr_stg->fastopen && !passive_fin_out.flags) /* Passive side was in fastopen. *Avalidpackethasbeenreceived,so *theSYNACKhasreachedthepeer. *Clearheadercbflagsifthereisnomore *optiontosend.
*/
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.