Packet::setRawPacket parses layers it should not when parseUntilLayer is set

Aperta
#657 13 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
networking

Direzione di ricerca

Read the parsing loop and cleanup logic in Packet++/src/Packet.cpp at the lines linked in the issue. Check how the parseUntilLayer comparison handles OsiModelTransportLayer, and verify the behavior with a packet containing DNS traffic. Done means parsing stops at UDP without parsing the DNS layer beyond the requested limit.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement help wanted

Hello, I found that Packet::setRawPacket is parsing too many layers when parseUntilLayer is set. If parseUntilLayer is set to OsiModelTransportLayer and the packet contains DNS traffic, it will still parse into the DNS layer even though it should stop at the UDP layer.

This is the offending loop, which parses until <= parseUntilLayer (should be just <?): https://github.com/seladb/PcapPlusPlus/blob/34987748e000b33f69a72770f70aa26e257ac0a4/Packet%2B%2B/src/Packet.cpp#L60-L68

There seems to be a hack in the code to clean up the extra layer if it went too far:
https://github.com/seladb/PcapPlusPlus/blob/34987748e000b33f69a72770f70aa26e257ac0a4/Packet%2B%2B/src/Packet.cpp#L76-L81

But this is extra work, and the result is that the DNS payload is parsed twice (because I do my own DNS parsing later based on just UDP payload from pcpp).

Lingua principale
C++
Stelle
3.1k
Fork
761
Merge medio
5g 11h
PR unite (30g)
27

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di seladb/PcapPlusPlus

Tutte le issue di seladb/PcapPlusPlus

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.