linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] packet.7: PACKET_LOSS has inverse meaning
@ 2014-04-22 16:01 Carsten Andrich
  2014-04-22 18:23 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 19+ messages in thread
From: Carsten Andrich @ 2014-04-22 16:01 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

Hey there,

I stumbled upon an error in packet.7 regarding the meaning of the
PACKET_LOSS socket option. According to the current git version of
linux-man setting PACKET_LOSS causes malformed packets to *not* be
silently dropped.

However it is the other way round. If PACKET_LOSS is *not* set,
malformed packets will be marked TP_STATUS_WRONG_FORMAT and the
transmission process aborted, leaving untransmitted packets in the ring.
If it *is* set, malformed packets will be silently skipped, their status
set to TP_STATUS_AVAILABLE and the transmission process continued with
the following packet.

This behaviour can be clearly seen in net/packet/af_packet.c:
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/packet/af_packet.c#n2300

The value accompanying TP_PACKET_LOSS translates into po->tp_loss:
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/packet/af_packet.c#n3304

I inverted the meaning of PACKET_LOSS and clarified the description in
the attached patch.

Cheers,
Carsten.


[-- Attachment #2: packet.7.patch --]
[-- Type: text/x-patch, Size: 1210 bytes --]

diff --git a/man7/packet.7 b/man7/packet.7
index d8257f9..5085814 100644
--- a/man7/packet.7
+++ b/man7/packet.7
@@ -319,9 +319,15 @@ original fanout algorithm selects a backlogged socket, the packet
 rolls over to the next available one.
 .TP
 .BR PACKET_LOSS " (with " PACKET_TX_RING )
-If set, do not silently drop a packet on transmission error, but
-return it with status set to
-.BR TP_STATUS_WRONG_FORMAT .
+When a malformed packet is encountered on a transmit ring, the default is to
+set its status to
+.BR TP_STATUS_WRONG_FORMAT
+and abort the transmission immediately (it and following packets are left
+lingering on the ring). However if
+.BR PACKET_LOSS
+is set, malformed packets will be skipped, their status reset to
+.BR TP_STATUS_AVAILABLE
+and the transmission process continued.
 .TP
 .BR PACKET_RESERVE " (with " PACKET_RX_RING )
 By default, a packet receive ring writes packets immediately following the
@@ -419,7 +425,7 @@ or
 then that overrides the socket default.
 On successful transmission, the socket resets the slot to
 .BR TP_STATUS_AVAILABLE .
-It discards packets silently on error unless
+It immediately aborts the transmission on error unless
 .BR PACKET_LOSS
 is set.
 .TP

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-04-25 11:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 16:01 [patch] packet.7: PACKET_LOSS has inverse meaning Carsten Andrich
2014-04-22 18:23 ` Michael Kerrisk (man-pages)
     [not found]   ` <5356B3BA.7050401-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-22 18:36     ` Willem de Bruijn
     [not found]       ` <CA+FuTSc=4fwH=+jX58teeQHrRse718qLBOLzAcrZJSYug2TfSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-22 18:55         ` Michael Kerrisk (man-pages)
     [not found]           ` <5356BB3F.4030502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-22 19:06             ` Carsten Andrich
2014-04-22 19:14             ` Willem de Bruijn
     [not found]               ` <CA+FuTScUexjc6bETYMVgPUgmN5CSR40=UrELT9N363Tvk1+waA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-22 20:53                 ` Carsten Andrich
     [not found]                   ` <1398200019.5031.24.camel-FQO4gtnRtnzkVFMGpb/cPg@public.gmane.org>
2014-04-23  6:06                     ` Michael Kerrisk (man-pages)
     [not found]                       ` <53575872.6080403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-23  8:51                         ` Carsten Andrich
2014-04-23 10:12                           ` Michael Kerrisk (man-pages)
     [not found]                             ` <53579224.3060006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-23 19:10                               ` Carsten Andrich
     [not found]                                 ` <1398280218.2416.18.camel-FQO4gtnRtnzkVFMGpb/cPg@public.gmane.org>
2014-04-24  8:20                                   ` Michael Kerrisk (man-pages)
     [not found]                                     ` <5358C957.8080402-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-24  9:39                                       ` Carsten Andrich
2014-04-24 10:21                                         ` Michael Kerrisk (man-pages)
     [not found]                                           ` <5358E59E.2000207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-24 10:45                                             ` Daniel Borkmann
     [not found]                                               ` <CA+FuTSf6_Lvs_Nht7TXPUT973rePz9hKEqv+YvPwXSq+kOoiyQ@mail.gmail.com>
     [not found]                                                 ` <CA+FuTSf6_Lvs_Nht7TXPUT973rePz9hKEqv+YvPwXSq+kOoiyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-24 19:07                                                   ` Carsten Andrich
     [not found]                                                     ` <1398366446.2647.4.camel-FQO4gtnRtnzkVFMGpb/cPg@public.gmane.org>
2014-04-25 11:20                                                       ` Neil Horman
2014-04-24 10:59                                             ` Neil Horman
2014-04-23 20:53                               ` Stefan Puiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).