- *(u16 *)(q + 2) = htons(8); // Length
- *(u8 *)(q + 4) = 3;
- *(u8 *)(q + 5) = 4;
- *(u16 *)(q + 6) = htons(0xC023); // PAP
- tunnelsend(b, 12 + 8, t);
+ *(u16 *)(q + 2) = htons(14); // Length
+ *(u8 *)(q + 4) = 5;
+ *(u8 *)(q + 5) = 6;
+ *(u32 *)(q + 6) = htonl(session[s].magic);
+ *(u8 *)(q + 10) = 3;
+ *(u8 *)(q + 11) = 4;
+ *(u16 *)(q + 12) = htons(PPPPAP); // PAP
+ tunnelsend(b, 12 + 14, t);
+}
+
+// Send CCP reply
+void sendccp(tunnelidt t, sessionidt s)
+{
+ char *q, b[500] = {0};
+
+ q = makeppp(b, sizeof(b), NULL, 0, t, s, PPPCCP);
+ *q = ConfigReq;
+ *(u8 *)(q + 1) = (time_now % 255) + 1; // ID
+ *(u16 *)(q + 2) = htons(4); // Length
+ log_hex(5, "PPPCCP", q, 4);
+ tunnelsend(b, (q - b) + 4 , t);