* Don't blame me. I didn't design this.
*/
- ret = openconnect_ppp_new(vpninfo, PPP_ENCAP_FORTINET_HDLC, ipv4, ipv6);
+ ret = openconnect_ppp_new(vpninfo, PPP_ENCAP_FORTINET, ipv4, ipv6);
out:
if (ret)
#define PPP_ENCAP_RFC1662_HDLC 2 /* PPP with HDLC-like framing (RFC1662) */
#define PPP_ENCAP_F5 3 /* F5 BigIP no HDLC */
#define PPP_ENCAP_F5_HDLC 4 /* F5 BigIP HDLC */
-#define PPP_ENCAP_FORTINET_HDLC 5 /* Fortinet HDLC */
-#define PPP_ENCAP_MAX PPP_ENCAP_FORTINET_HDLC
+#define PPP_ENCAP_FORTINET 5 /* Fortinet no HDLC */
+#define PPP_ENCAP_MAX PPP_ENCAP_FORTINET
#define COMPR_DEFLATE (1<<0)
#define COMPR_LZS (1<<1)
"RFC1662 HDLC",
"F5",
"F5 HDLC",
- "FORTINET HDLC",
+ "FORTINET",
};
static const char *lcp_names[] = {
ppp->encap_len = 4;
break;
- case PPP_ENCAP_FORTINET_HDLC:
+ case PPP_ENCAP_FORTINET:
+ ppp->encap_len = 6;
ppp->check_http_response = 1;
- /* fall through */
+ break;
case PPP_ENCAP_F5_HDLC:
/* XX: F5 server cancels our IP address allocation if we PPP-terminate */
}
break;
+ case PPP_ENCAP_FORTINET:
+ payload_len = load_be16(eh + 4);
+ magic = load_be16(eh + 2);
+ next = eh + 6 + payload_len;
+
+ if (magic != 0x5050 || (load_be16(eh) != payload_len + 6))
+ goto bad_encap_header;
+ if (len < 6 + payload_len)
+ goto incomplete_pkt;
+ break;
+
case PPP_ENCAP_F5_HDLC:
case PPP_ENCAP_RFC1662_HDLC:
payload_len = unhdlc_in_place(vpninfo, eh + ppp->encap_len, len - ppp->encap_len, &next);
store_be16(eh, 0xf500);
store_be16(eh + 2, this->len + this->ppp.hlen);
break;
+ case PPP_ENCAP_FORTINET:
+ /* XX: header contains both TOTAL bytes-on-wire, and (bytes-on-wire excluding this header) */
+ store_be16(eh, this->len + this->ppp.hlen + 6);
+ store_be16(eh + 2, 0x5050);
+ store_be16(eh + 4, this->len + this->ppp.hlen);
+ break;
}
this->ppp.hlen += ppp->encap_len;