- case 2: // asyncmap
- log_hex(2, "PPP LCP Packet", p, l);
- log(2, 0, 0, 0, "PPP LCP Packet type %d (%s len %d)\n", *p, ppp_lcp_types[(int)*p], ntohs( ((u16 *) p)[1]) );
+
+ case 2: // Async-Control-Character-Map
+ if (!ntohl(*(uint32_t *)(o + 2))) // all bits zero is OK
+ break;
+
+ if (response && *response != ConfigNak) // rej already queued
+ break;
+
+ LOG(2, s, t, " Remote requesting asyncmap. Rejecting.\n");
+ if (!response)
+ {
+ q = response = makeppp(b, sizeof(b), p, 2, t, s, PPPLCP);
+ if (!q) break;
+ *q = ConfigNak;
+ q += 4;
+ }
+
+ if ((q - b + 11) > sizeof(b))
+ {
+ LOG(2, s, t, "LCP overflow for asyncmap ConfigNak.\n");
+ break;
+ }
+
+ *q++ = type;
+ *q++ = 6;
+ memset(q, 0, 4); // asyncmap 0
+ q += 4;
+ *((uint16_t *) (response + 2)) = htons(q - response); // LCP header length