Re: [PATCH v1 2/5] j1939: transport: don't process not local transports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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 |



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux