nvlist_t *nvl;
int ret;
+ msg(D_DCO_DEBUG, "%s: peer-id %d, ping interval %d, ping timeout %d",
+ __func__, peerid, keepalive_interval, keepalive_timeout);
+
nvl = nvlist_create(0);
nvlist_add_number(nvl, "peerid", peerid);
nvlist_add_number(nvl, "interval", keepalive_interval);
|| !memcmp(a, &zero, sizeof(struct sha256_digest));
}
+static bool
+p2p_set_dco_keepalive(struct context *c)
+{
+ if (dco_enabled(&c->options)
+ && (c->options.ping_send_timeout || c->c2.frame.mss_fix))
+ {
+ int ret = dco_set_peer(&c->c1.tuntap->dco,
+ c->c2.tls_multi->dco_peer_id,
+ c->options.ping_send_timeout,
+ c->options.ping_rec_timeout,
+ c->c2.frame.mss_fix);
+ if (ret < 0)
+ {
+ msg(D_DCO, "Cannot set parameters for DCO peer (id=%u): %s",
+ c->c2.tls_multi->dco_peer_id, strerror(-ret));
+ return false;
+ }
+ }
+ return true;
+}
/**
* This function is expected to be invoked after open_tun() was performed.
*
return false;
}
- if (dco_enabled(&c->options)
- && (c->options.ping_send_timeout || c->c2.frame.mss_fix))
- {
- int ret = dco_set_peer(&c->c1.tuntap->dco,
- c->c2.tls_multi->dco_peer_id,
- c->options.ping_send_timeout,
- c->options.ping_rec_timeout,
- c->c2.frame.mss_fix);
- if (ret < 0)
- {
- msg(D_DCO, "Cannot set parameters for DCO peer (id=%u): %s",
- c->c2.tls_multi->dco_peer_id, strerror(-ret));
- return false;
- }
- }
-
return true;
}
}
}
+ if (c->mode == MODE_POINT_TO_POINT && !p2p_set_dco_keepalive(c))
+ {
+ msg(D_TLS_ERRORS, "ERROR: Failed to apply DCO keepalive or MSS fix parameters");
+ return false;
+ }
+
if (c->c2.did_open_tun)
{
c->c1.pulled_options_digest_save = c->c2.pulled_options_digest;