On vr, 05 apr 2019 07:45:05 +0200, Oleksij Rempel wrote: > 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. So I swapped my interpretation, but the way you explain it makes sense. > > 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(). but use sendto() and recvfrom(), you mean. I agree. Good job! Kurt