mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
Added config file option ping-leases.
This commit is contained in:
@@ -185,6 +185,7 @@ unsigned j;
|
||||
READ_TF("always-require-cert", config->force_cert_auth, 0, 1);
|
||||
READ_TF("use-utmp", config->use_utmp, 0, 1);
|
||||
READ_TF("try-mtu-discovery", config->try_mtu, 0, 0);
|
||||
READ_TF("ping-leases", config->ping_leases, 0, 0);
|
||||
|
||||
READ_STRING("tls-priorities", config->priorities, 0);
|
||||
READ_STRING("chroot-dir", config->chroot_dir, 0);
|
||||
|
||||
@@ -172,6 +172,9 @@ int icmp_ping4(main_server_st * s, struct sockaddr_in *addr1,
|
||||
time_t now;
|
||||
uint16_t id1, id2;
|
||||
unsigned gotreply = 0, unreachable = 0;
|
||||
|
||||
if (s->config->ping_leases == 0)
|
||||
return 0;
|
||||
|
||||
gnutls_rnd(GNUTLS_RND_NONCE, &id1, sizeof(id1));
|
||||
gnutls_rnd(GNUTLS_RND_NONCE, &id2, sizeof(id2));
|
||||
@@ -266,6 +269,9 @@ int icmp_ping6(main_server_st * s,
|
||||
unsigned gotreply = 0, unreachable = 0;
|
||||
time_t now;
|
||||
|
||||
if (s->config->ping_leases == 0)
|
||||
return 0;
|
||||
|
||||
gnutls_rnd(GNUTLS_RND_NONCE, &id1, sizeof(id1));
|
||||
gnutls_rnd(GNUTLS_RND_NONCE, &id2, sizeof(id2));
|
||||
|
||||
@@ -279,7 +285,7 @@ int icmp_ping6(main_server_st * s,
|
||||
pkt = (struct icmp6_hdr *) packet2;
|
||||
memset(pkt, 0, sizeof(packet2));
|
||||
pkt->icmp6_type = ICMP6_ECHO_REQUEST;
|
||||
pkt->icmp6_id = id1;
|
||||
pkt->icmp6_id = id2;
|
||||
|
||||
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
|
||||
setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* DO NOT EDIT THIS FILE (ocserv-args.c)
|
||||
*
|
||||
* It has been AutoGen-ed April 28, 2013 at 03:30:39 PM by AutoGen 5.17.3
|
||||
* It has been AutoGen-ed April 29, 2013 at 12:12:15 AM by AutoGen 5.17.3
|
||||
* From the definitions ocserv-args.def
|
||||
* and the template file options
|
||||
*
|
||||
|
||||
@@ -237,6 +237,10 @@ ipv4-dns = local
|
||||
#ipv6-dns =
|
||||
#ipv6-nbns =
|
||||
|
||||
# Prior to leasing any IP from the pool ping it to verify that
|
||||
# it is not in use by another (unrelated to this server) host.
|
||||
ping-leases = false
|
||||
|
||||
# Unset to assign the default MTU of the device
|
||||
# mtu =
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* DO NOT EDIT THIS FILE (ocserv-args.h)
|
||||
*
|
||||
* It has been AutoGen-ed April 28, 2013 at 03:30:39 PM by AutoGen 5.17.3
|
||||
* It has been AutoGen-ed April 29, 2013 at 12:12:15 AM by AutoGen 5.17.3
|
||||
* From the definitions ocserv-args.def
|
||||
* and the template file options
|
||||
*
|
||||
|
||||
@@ -104,6 +104,7 @@ struct cfg_st {
|
||||
unsigned try_mtu; /* MTU discovery enabled */
|
||||
unsigned force_cert_auth; /* always require client certificate */
|
||||
unsigned rate_limit_ms; /* if non zero force a connection every rate_limit milliseconds */
|
||||
unsigned ping_leases; /* non zero if we need to ping prior to leasing */
|
||||
|
||||
/* if gdbm is there */
|
||||
char* cookie_db_name;
|
||||
|
||||
Reference in New Issue
Block a user