- q = makeppp(b, NULL, 0, t, s, PPPLCP);
- log(4, 0, s, t, "Sending LCP ConfigReq for PAP\n");
+ q = makeppp(b, sizeof(b), NULL, 0, t, s, PPPLCP);
+ if (!q) {
+ LOG(1, 0, s, t, "Failed to send LCP ConfigReq.\n");
+ return;
+ }
+ LOG(4, 0, s, t, "Sending LCP ConfigReq for PAP\n");
+ *q = ConfigReq;
+ *(u8 *)(q + 1) = (time_now % 255) + 1; // ID
+ *(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);