On za, 03 nov 2018 09:24:42 +0100, Oleksij Rempel wrote: > On Fri, Nov 02, 2018 at 07:40:48PM +0100, Kurt Van Dijck wrote: > > On vr, 02 nov 2018 12:32:19 +0100, Oleksij Rempel wrote: > > > > > > we will drop this packets soon or later... so drop it better ASAP. > > > > This is true, unless you monitor all j1939 traffic in 'promiscuous' > > mode. I'm not sure if that hasn't been thrown away yet, and is something > > designed to be used on a PC anyway. You could extend the check a bit. > > Same like with ipv4/ipv6/tcp/udp stacks, we do not process unrelated > traffic. We capture RAW Ethernet traffic. In this case, in promiscuous mode we > should capture RAW CAN traffic, not decoded J1939 traffic. That means a userspace decoder for j1939 promiscuous spying. That makes sense. > > Please fix me, if I oversee some thing. > > > > > > > Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> > > > --- > > > net/can/j1939/transport.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c > > > index 27cf1738f77a..ad7677f8c7f1 100644 > > > --- a/net/can/j1939/transport.c > > > +++ b/net/can/j1939/transport.c > > > @@ -1237,6 +1237,9 @@ int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb) > > > struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb); > > > const u8 *dat; > > > > > > + if (!j1939_tp_im_involved_anydir(skb)) > > > + return 0; > > > + > > > switch (skcb->addr.pgn) { > > > case J1939_ETP_PGN_DAT: > > > j1939_xtp_rx_dat(priv, skb, J1939_EXTENDED); > > > -- > > > 2.19.1 > > > > > > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |