mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
send the IPv6 netmask in a compatible with cisco servers way
This commit is contained in:
@@ -48,6 +48,8 @@ message auth_reply_msg
|
||||
repeated string nbns = 23;
|
||||
optional bool no_udp = 24 [default = false];
|
||||
optional string xml_config_file = 26;
|
||||
optional string ipv4_network = 27;
|
||||
optional string ipv6_network = 28;
|
||||
}
|
||||
|
||||
/* RESUME_FETCH_REQ + RESUME_DELETE_REQ */
|
||||
|
||||
@@ -85,6 +85,10 @@ int send_cookie_auth_reply(main_server_st* s, struct proc_st* proc,
|
||||
|
||||
msg.ipv4_netmask = proc->config.ipv4_netmask;
|
||||
msg.ipv6_netmask = proc->config.ipv6_netmask;
|
||||
|
||||
msg.ipv4_network = proc->config.ipv4_network;
|
||||
msg.ipv6_network = proc->config.ipv6_network;
|
||||
|
||||
msg.ipv6_prefix = proc->config.ipv6_prefix;
|
||||
if (proc->config.rx_per_sec != 0) {
|
||||
msg.has_rx_per_sec = 1;
|
||||
|
||||
@@ -156,9 +156,11 @@ struct group_cfg_st {
|
||||
struct vpn_st {
|
||||
char name[IFNAMSIZ];
|
||||
char *ipv4_netmask;
|
||||
char *ipv4_network;
|
||||
char *ipv4;
|
||||
char *ipv4_local; /* local IPv4 address */
|
||||
char *ipv6_netmask;
|
||||
char *ipv6_network;
|
||||
unsigned ipv6_prefix;
|
||||
|
||||
char *ipv6;
|
||||
|
||||
@@ -554,6 +554,18 @@ static int recv_cookie_auth_reply(worker_st * ws)
|
||||
talloc_strdup(ws, msg->ipv6_netmask);
|
||||
}
|
||||
|
||||
if (msg->ipv4_network != NULL) {
|
||||
talloc_free(ws->config->network.ipv4_network);
|
||||
ws->config->network.ipv4_network =
|
||||
talloc_strdup(ws, msg->ipv4_network);
|
||||
}
|
||||
|
||||
if (msg->ipv6_network != NULL) {
|
||||
talloc_free(ws->config->network.ipv6_network);
|
||||
ws->config->network.ipv6_network =
|
||||
talloc_strdup(ws, msg->ipv6_network);
|
||||
}
|
||||
|
||||
ws->config->network.ipv6_prefix = msg->ipv6_prefix;
|
||||
|
||||
if (msg->has_rx_per_sec)
|
||||
|
||||
@@ -224,6 +224,9 @@ int complete_vpn_info(worker_st * ws, struct vpn_st *vinfo)
|
||||
if (check_if_default_route(vinfo->routes, vinfo->routes_size))
|
||||
ws->default_route = 1;
|
||||
|
||||
vinfo->ipv4_network = ws->config->network.ipv4_network;
|
||||
vinfo->ipv6_network = ws->config->network.ipv6_network;
|
||||
|
||||
vinfo->ipv4_netmask = ws->config->network.ipv4_netmask;
|
||||
vinfo->ipv6_netmask = ws->config->network.ipv6_netmask;
|
||||
vinfo->ipv6_prefix = ws->config->network.ipv6_prefix;
|
||||
|
||||
+7
-7
@@ -1514,14 +1514,14 @@ static int connect_handler(worker_st * ws)
|
||||
tls_printf(ws->session, "X-CSTP-Address: %s\r\n",
|
||||
ws->vinfo.ipv6);
|
||||
SEND_ERR(ret);
|
||||
}
|
||||
|
||||
if (ws->vinfo.ipv6_netmask) {
|
||||
ret =
|
||||
tls_printf(ws->session,
|
||||
"X-CSTP-Netmask: %u\r\n",
|
||||
ws->vinfo.ipv6_prefix);
|
||||
SEND_ERR(ret);
|
||||
}
|
||||
if (ws->vinfo.ipv6_network && ws->vinfo.ipv6_prefix != 0) {
|
||||
ret =
|
||||
tls_printf(ws->session,
|
||||
"X-CSTP-Netmask: %s/%u\r\n",
|
||||
ws->vinfo.ipv6_network, ws->vinfo.ipv6_prefix);
|
||||
SEND_ERR(ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user