Home | History | Annotate | Download | only in rp-pppoe

Lines Matching refs:packet

73 * packet -- a received PPPoE packet
75 * 1 if packet is for this PPPoE daemon; 0 otherwise.
77 * If we are using the Host-Unique tag, verifies that packet contains
81 packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet)
85 /* If packet is not directed to our MAC address, forget it */
86 if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0;
88 /* If we're not using the Host-Unique tag, then accept the packet */
91 parsePacket(packet, parseForHostUniq, &forMe);
107 * Picks interesting tags out of a PADO packet
203 * Picks interesting tags out of a PADS packet
241 * Sends a PADI packet
246 PPPoEPacket packet;
247 unsigned char *cursor = packet.payload;
248 PPPoETag *svc = (PPPoETag *) (&packet.payload);
256 CHECK_ROOM(cursor, packet.payload, plen);
259 memset(packet.ethHdr.h_dest, 0xFF, ETH_ALEN);
260 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN);
262 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery);
263 packet.ver = 1;
264 packet.type = 1;
265 packet.code = CODE_PADI;
266 packet.session = 0;
270 CHECK_ROOM(cursor, packet.payload, namelen+TAG_HDR_SIZE);
284 CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE);
290 packet.length = htons(plen);
292 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE));
294 dumpPacket(conn->debugFile, &packet, "SENT");
308 * Waits for a PADO packet and copies useful information
316 PPPoEPacket packet;
344 /* Get the packet */
345 receivePacket(conn->discoverySocket, &packet, &len);
348 if (ntohs(packet.length) + HDR_SIZE > len) {
350 (unsigned int) ntohs(packet.length));
355 /* If it's not a Discovery packet, loop again */
356 if (etherType(&packet) != Eth_PPPOE_Discovery) continue;
360 dumpPacket(conn->debugFile, &packet, "RCVD");
365 if (!packetIsForMe(conn, &packet)) continue;
367 if (packet.code == CODE_PADO) {
368 if (NOT_UNICAST(packet.ethHdr.h_source)) {
369 printErr("Ignoring PADO packet from non-unicast MAC address");
372 parsePacket(&packet, parsePADOTags, &pc);
374 printErr("Ignoring PADO packet with no AC-Name tag");
378 printErr("Ignoring PADO packet with no Service-Name tag");
386 memcpy(conn->peerEth, packet.ethHdr.h_source, ETH_ALEN);
411 * Sends a PADR packet
416 PPPoEPacket packet;
417 PPPoETag *svc = (PPPoETag *) packet.payload;
418 unsigned char *cursor = packet.payload;
427 CHECK_ROOM(cursor, packet.payload, plen);
429 memcpy(packet.ethHdr.h_dest, conn->peerEth, ETH_ALEN);
430 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN);
432 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery);
433 packet.ver = 1;
434 packet.type = 1;
435 packet.code = CODE_PADR;
436 packet.session = 0;
452 CHECK_ROOM(cursor, packet.payload, sizeof(pid)+TAG_HDR_SIZE);
460 CHECK_ROOM(cursor, packet.payload,
468 CHECK_ROOM(cursor, packet.payload,
475 packet.length = htons(plen);
476 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE));
478 dumpPacket(conn->debugFile, &packet, "SENT");
492 * Waits for a PADS packet and copies useful information
500 PPPoEPacket packet;
521 /* Get the packet */
522 receivePacket(conn->discoverySocket, &packet, &len);
525 if (ntohs(packet.length) + HDR_SIZE > len) {
527 (unsigned int) ntohs(packet.length));
532 /* If it's not a Discovery packet, loop again */
533 if (etherType(&packet) != Eth_PPPOE_Discovery) continue;
536 dumpPacket(conn->debugFile, &packet, "RCVD");
542 if (memcmp(packet.ethHdr.h_source, conn->peerEth, ETH_ALEN)) continue;
545 if (!packetIsForMe(conn, &packet)) continue;
548 if (packet.code == CODE_PADS) {
550 parsePacket(&packet, parsePADSTags, conn);
557 conn->session = packet.session;