Lines Matching refs:packet
46 parsePacket(PPPoEPacket *packet, ParseFunc *func, void *extra) in parsePacket() argument
48 UINT16_t len = ntohs(packet->length); in parsePacket()
52 if (packet->ver != 1) { in parsePacket()
53 syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); in parsePacket()
56 if (packet->type != 1) { in parsePacket()
57 syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); in parsePacket()
68 curTag = packet->payload; in parsePacket()
69 while(curTag - packet->payload < len) { in parsePacket()
78 if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { in parsePacket()
101 findTag(PPPoEPacket *packet, UINT16_t type, PPPoETag *tag) in findTag() argument
103 UINT16_t len = ntohs(packet->length); in findTag()
107 if (packet->ver != 1) { in findTag()
108 syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); in findTag()
111 if (packet->type != 1) { in findTag()
112 syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); in findTag()
123 curTag = packet->payload; in findTag()
124 while(curTag - packet->payload < len) { in findTag()
133 if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { in findTag()
243 clampMSS(PPPoEPacket *packet, char const *dir, int clampMss) in clampMSS() argument
255 if (packet->payload[0] & 0x01) { in clampMSS()
259 if (packet->payload[0] != 0x21) { in clampMSS()
264 ipHdr = packet->payload + 1; in clampMSS()
270 if (packet->payload[0] != 0x00 || in clampMSS()
271 packet->payload[1] != 0x21) { in clampMSS()
276 ipHdr = packet->payload + 2; in clampMSS()
281 len = (int) ntohs(packet->length); in clampMSS()
398 PPPoEPacket packet; in sendPADT() local
399 unsigned char *cursor = packet.payload; in sendPADT()
409 memcpy(packet.ethHdr.h_dest, conn->peerEth, ETH_ALEN); in sendPADT()
410 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN); in sendPADT()
412 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery); in sendPADT()
413 packet.ver = 1; in sendPADT()
414 packet.type = 1; in sendPADT()
415 packet.code = CODE_PADT; in sendPADT()
416 packet.session = conn->session; in sendPADT()
448 CHECK_ROOM(cursor, packet.payload, in sendPADT()
456 CHECK_ROOM(cursor, packet.payload, in sendPADT()
463 packet.length = htons(plen); in sendPADT()
464 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE)); in sendPADT()
466 dumpPacket(conn->debugFile, &packet, "SENT"); in sendPADT()