+ #endif
+
+ // No checksum in IPv6
+
+ // Check Packet length
+ if( ntohs(hdr->PayloadLength)+sizeof(tIPv6Header) > Length) {
+ Log_Log("IPv6", "hdr->PayloadLength(%i) > Length(%i)", ntohs(hdr->PayloadLength), Length);
+ return;
+ }
+
+ // Process Options
+ nextHeader = hdr->NextHeader;
+ dataPtr = hdr->Data;
+ dataLength = hdr->PayloadLength;
+ for( ;; )
+ {
+ struct {
+ Uint8 NextHeader;
+ Uint8 Length; // In 8-byte chunks, with 0 being 8 bytes long
+ Uint8 Data[];
+ } *optionHdr;
+ optionHdr = (void*)dataPtr;
+ // Hop-by-hop options
+ if(nextHeader == 0)
+ {
+ // TODO: Parse the options (actually, RFC2460 doesn't specify any)
+ }
+ // Routing Options
+ else if(nextHeader == 43)
+ {
+ // TODO: Routing Header options
+ }
+ else
+ {
+ break; // Unknown, pass on
+ }
+ nextHeader = optionHdr->NextHeader;
+ dataPtr += (optionHdr->Length + 1) * 8; // 8-octet length (0 = 8 bytes long)
+ }
+
+ // Get Interface (allowing broadcasts)
+ iface = IPv6_GetInterface(Adapter, hdr->Destination, 1);
+
+ // Firewall rules
+ if( iface ) {
+ // Incoming Packets
+ ret = IPTables_TestChain("INPUT",
+ 6, &hdr->Source, &hdr->Destination,
+ hdr->NextHeader, 0,
+ hdr->PayloadLength, hdr->Data
+ );
+ }
+ else {
+ // Routed packets
+ ret = IPTables_TestChain("FORWARD",
+ 6, &hdr->Source, &hdr->Destination,
+ hdr->NextHeader, 0,
+ hdr->PayloadLength, hdr->Data
+ );
+ }