Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarify a few uncommented corners of the ESP support
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
  • Loading branch information
dlenski committed Aug 2, 2018
1 parent 0281a8e commit a4b9d85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions esp.c
Expand Up @@ -146,6 +146,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout)
len);
work_done = 1;

/* both supported algos (SHA1 and MD5) have 12-byte MAC lengths (RFC2403 and RFC2404) */
if (len <= sizeof(pkt->esp) + 12)
continue;

Expand All @@ -169,6 +170,11 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout)
continue;
}

/* Possible values of the Next Header field are:
0x04: IP[v4]-in-IP
0x05: supposed to mean Internet Stream Protocol
(XXX: but used for LZO compressed packets by Juniper)
0x29: IPv6 encapsulation */
if (pkt->data[len - 1] != 0x04 && pkt->data[len - 1] != 0x29 &&
pkt->data[len - 1] != 0x05) {
vpn_progress(vpninfo, PRG_ERR,
Expand Down
3 changes: 2 additions & 1 deletion library.c
Expand Up @@ -904,7 +904,8 @@ int openconnect_setup_tun_device(struct openconnect_info *vpninfo,
static const char *compr_name_map[] = {
[COMPR_DEFLATE] = "Deflate",
[COMPR_LZS] = "LZS",
[COMPR_LZ4] = "LZ4"
[COMPR_LZ4] = "LZ4",
[COMPR_LZO] = "LZO",
};

const char *openconnect_get_cstp_compression(struct openconnect_info * vpninfo)
Expand Down
1 change: 1 addition & 0 deletions oncp.c
Expand Up @@ -323,6 +323,7 @@ static int process_attr(struct openconnect_info *vpninfo, int group, int attr,
if (attrlen != 1)
goto badlen;
vpninfo->esp_compr = data[0];
vpninfo->dtls_compr = data[0] ? COMPR_LZO : 0;
vpn_progress(vpninfo, PRG_DEBUG, _("ESP compression: %d\n"), data[0]);
break;

Expand Down
5 changes: 3 additions & 2 deletions openconnect-internal.h
Expand Up @@ -174,10 +174,11 @@ struct pkt {
#define COMPR_DEFLATE (1<<0)
#define COMPR_LZS (1<<1)
#define COMPR_LZ4 (1<<2)
#define COMPR_MAX COMPR_LZ4
#define COMPR_LZO (1<<3)
#define COMPR_MAX COMPR_LZO

#ifdef HAVE_LZ4
#define COMPR_STATELESS (COMPR_LZS | COMPR_LZ4)
#define COMPR_STATELESS (COMPR_LZS | COMPR_LZ4 | COMPR_LZO)
#else
#define COMPR_STATELESS (COMPR_LZS)
#endif
Expand Down

0 comments on commit a4b9d85

Please sign in to comment.