Re: [PATCH v1 09/25] j1939: socket: add j1939_sk_match_dst

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

 



Hi Kurt,

On Thu, Apr 04, 2019 at 07:57:46PM +0200, Kurt Van Dijck wrote:
> On vr, 29 mrt 2019 14:58:43 +0100, Oleksij Rempel wrote:
> > +	if (j1939_pgn_is_valid(jsk->pgn_rx_filter) &&
> > +	    jsk->pgn_rx_filter != skcb->addr.dst_pgn)
> > +		return false;
> 
> I must have misunderstood the introduction of pgn_rx_filter.
> I'd assume that the PGN used during bind() is used for transmission,
> and the one using connect() is used for reception.
> Did I swap, or did I get compeletely lost?

Kind of :), both bind() and connect() was setting destination PGN.

With bind() we configure local socket, so default receiver setting should
be configured: source address, source name and (kind of source) PGN.
With connect() we configure target settings: dst address, dst name and
dst PGN.

Since on the wire we have only destination PGN, source PGN can only be
used for receiver filter.

I know, on CAN is every thing broadcast and in reality J1939 software in
many cases will need to be able to receive more then one PGN. So, with
this change you have a choice to create simple connect()ed peer to peer
socket and use plain send()/recv(), see jcat in can-utils. Or more
advanced socket with custom filters. In the last case, it is impossible
to use send() and recv().

-- 
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