Lines Matching refs:packet

45 parsePacket(PPPoEPacket *packet, ParseFunc *func, void *extra)  in parsePacket()  argument
47 UINT16_t len = ntohs(packet->length); in parsePacket()
51 if (PPPOE_VER(packet->vertype) != 1) { in parsePacket()
52 error("Invalid PPPoE version (%d)", PPPOE_VER(packet->vertype)); in parsePacket()
55 if (PPPOE_TYPE(packet->vertype) != 1) { in parsePacket()
56 error("Invalid PPPoE type (%d)", PPPOE_TYPE(packet->vertype)); in parsePacket()
67 curTag = packet->payload; in parsePacket()
68 while(curTag - packet->payload < len) { in parsePacket()
75 if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { in parsePacket()
98 PPPoEPacket packet; in sendPADT() local
99 unsigned char *cursor = packet.payload; in sendPADT()
109 memcpy(packet.ethHdr.h_dest, conn->peerEth, ETH_ALEN); in sendPADT()
110 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN); in sendPADT()
112 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery); in sendPADT()
113 packet.vertype = PPPOE_VER_TYPE(1, 1); in sendPADT()
114 packet.code = CODE_PADT; in sendPADT()
115 packet.session = conn->session; in sendPADT()
147 CHECK_ROOM(cursor, packet.payload, in sendPADT()
155 CHECK_ROOM(cursor, packet.payload, in sendPADT()
162 packet.length = htons(plen); in sendPADT()
163 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE)); in sendPADT()
170 void pppoe_printpkt(PPPoEPacket *packet, in pppoe_printpkt() argument
173 int len = ntohs(packet->length); in pppoe_printpkt()
176 switch (ntohs(packet->ethHdr.h_proto)) { in pppoe_printpkt()
178 printer(arg, "PPPOE Discovery V%dT%d ", PPPOE_VER(packet->vertype), in pppoe_printpkt()
179 PPPOE_TYPE(packet->vertype)); in pppoe_printpkt()
180 switch (packet->code) { in pppoe_printpkt()
197 printer(arg, "unknown code %x", packet->code); in pppoe_printpkt()
199 printer(arg, " session 0x%x length %d\n", ntohs(packet->session), len); in pppoe_printpkt()
202 printer(arg, "PPPOE Session V%dT%d", PPPOE_VER(packet->vertype), in pppoe_printpkt()
203 PPPOE_TYPE(packet->vertype)); in pppoe_printpkt()
204 printer(arg, " code 0x%x session 0x%x length %d\n", packet->code, in pppoe_printpkt()
205 ntohs(packet->session), len); in pppoe_printpkt()
209 ntohs(packet->ethHdr.h_proto)); in pppoe_printpkt()
212 printer(arg, " dst %02x:%02x:%02x:%02x:%02x:%02x ", EH(packet->ethHdr.h_dest)); in pppoe_printpkt()
213 printer(arg, " src %02x:%02x:%02x:%02x:%02x:%02x\n", EH(packet->ethHdr.h_source)); in pppoe_printpkt()
214 if (ntohs(packet->ethHdr.h_proto) != ETH_PPPOE_DISCOVERY) in pppoe_printpkt()
218 tag = (packet->payload[i] << 8) + packet->payload[i+1]; in pppoe_printpkt()
219 tlen = (packet->payload[i+2] << 8) + packet->payload[i+3]; in pppoe_printpkt()
269 printer(arg, " %.*v", tlen, &packet->payload[i]); in pppoe_printpkt()
271 printer(arg, " %.*B", tlen, &packet->payload[i]); in pppoe_printpkt()
274 &packet->payload[i], tlen); in pppoe_printpkt()
281 void pppoe_log_packet(const char *prefix, PPPoEPacket *packet) in pppoe_log_packet() argument
284 pppoe_printpkt(packet, pr_log, NULL); in pppoe_log_packet()