Lines Matching refs:packet

105 packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet)  in packetIsForMe()  argument
110 if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; in packetIsForMe()
115 parsePacket(packet, parseForHostUniq, &forMe); in packetIsForMe()
265 PPPoEPacket packet; in sendPADI() local
266 unsigned char *cursor = packet.payload; in sendPADI()
267 PPPoETag *svc = (PPPoETag *) (&packet.payload); in sendPADI()
280 memset(packet.ethHdr.h_dest, 0xFF, ETH_ALEN); in sendPADI()
281 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN); in sendPADI()
283 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery); in sendPADI()
284 packet.vertype = PPPOE_VER_TYPE(1, 1); in sendPADI()
285 packet.code = CODE_PADI; in sendPADI()
286 packet.session = 0; in sendPADI()
290 CHECK_ROOM(cursor, packet.payload, plen); in sendPADI()
310 CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE); in sendPADI()
323 CHECK_ROOM(cursor, packet.payload, sizeof(mru) + TAG_HDR_SIZE); in sendPADI()
329 packet.length = htons(plen); in sendPADI()
331 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE)); in sendPADI()
352 PPPoEPacket packet; in waitForPADO() local
391 receivePacket(conn->discoverySocket, &packet, &len); in waitForPADO()
394 if (ntohs(packet.length) + HDR_SIZE > len) { in waitForPADO()
396 (unsigned int) ntohs(packet.length)); in waitForPADO()
402 if (etherType(&packet) != Eth_PPPOE_Discovery) continue; in waitForPADO()
406 if (!packetIsForMe(conn, &packet)) continue; in waitForPADO()
408 if (packet.code == CODE_PADO) { in waitForPADO()
409 if (NOT_UNICAST(packet.ethHdr.h_source)) { in waitForPADO()
414 && memcmp(packet.ethHdr.h_source, conn->req_peer_mac, ETH_ALEN) != 0) { in waitForPADO()
418 if (parsePacket(&packet, parsePADOTags, &pc) < 0) in waitForPADO()
432 memcpy(conn->peerEth, packet.ethHdr.h_source, ETH_ALEN); in waitForPADO()
452 PPPoEPacket packet; in sendPADR() local
453 PPPoETag *svc = (PPPoETag *) packet.payload; in sendPADR()
454 unsigned char *cursor = packet.payload; in sendPADR()
463 CHECK_ROOM(cursor, packet.payload, plen); in sendPADR()
465 memcpy(packet.ethHdr.h_dest, conn->peerEth, ETH_ALEN); in sendPADR()
466 memcpy(packet.ethHdr.h_source, conn->myEth, ETH_ALEN); in sendPADR()
468 packet.ethHdr.h_proto = htons(Eth_PPPOE_Discovery); in sendPADR()
469 packet.vertype = PPPOE_VER_TYPE(1, 1); in sendPADR()
470 packet.code = CODE_PADR; in sendPADR()
471 packet.session = 0; in sendPADR()
487 CHECK_ROOM(cursor, packet.payload, sizeof(pid)+TAG_HDR_SIZE); in sendPADR()
500 CHECK_ROOM(cursor, packet.payload, sizeof(mru) + TAG_HDR_SIZE); in sendPADR()
508 CHECK_ROOM(cursor, packet.payload, in sendPADR()
516 CHECK_ROOM(cursor, packet.payload, in sendPADR()
523 packet.length = htons(plen); in sendPADR()
524 sendPacket(conn, conn->discoverySocket, &packet, (int) (plen + HDR_SIZE)); in sendPADR()
545 PPPoEPacket packet; in waitForPADS() local
576 receivePacket(conn->discoverySocket, &packet, &len); in waitForPADS()
579 if (ntohs(packet.length) + HDR_SIZE > len) { in waitForPADS()
581 (unsigned int) ntohs(packet.length)); in waitForPADS()
587 if (etherType(&packet) != Eth_PPPOE_Discovery) continue; in waitForPADS()
591 if (memcmp(packet.ethHdr.h_source, conn->peerEth, ETH_ALEN)) continue; in waitForPADS()
594 if (!packetIsForMe(conn, &packet)) continue; in waitForPADS()
597 if (packet.code == CODE_PADS) { in waitForPADS()
599 if (parsePacket(&packet, parsePADSTags, conn) < 0) in waitForPADS()
609 conn->session = packet.session; in waitForPADS()