PROJET AUTOBLOG


Shaarli - Les discussions de Shaarli

Archivé

Site original : Shaarli - Les discussions de Shaarli du 23/07/2013

⇐ retour index

gopacket/pfring.go at master · packetbeat/gopacket · GitHub

jeudi 27 août 2015 à 13:16
GuiGui's Show - Liens
Hum, il y'a une erreur là... La doc de pf_ring (http://safemedia.com/builds/UsersGuide.pdf) nous dit :
« int pfring_send(pfring *ring, u_char *pkt, u_int pkt_len, u_int8_t flush_packet)
Although PF_RING has been optimized for RX, it is also possible to send packets (TX). This function allows
to send a raw packet (i.e. it is sent on wire as specified). This packet must be fully specified (the MAC
address up) and it will be transmitted as-is without any further manipulation.
[...]
Return value:
The number of bytes sent if success, a negative value otherwise. »

Là, le code dans gopacket retourne une erreur pour tout retour de pfring_send différent de 0. Or, un nombre positif indique un succès, pas un échec pour envoyer le paquet ! Donc, si tu utilises gopacket + la lib pf_ring, que tu injectes des paquets avec WritePacketData() et que t'as l'erreur  « Unable to send packet data, got error code 60 » (60 peut-être un autre nombre ;) ), ne cherches pas plus loin. :D

Patch : « if rv := C.pfring_send(r.cptr, buf, C.u_int(len(data)), 1); rv < 0 { »
(Permalink)