mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
jacd: use sendto instead of send
Accordint to the new UAPI version, bind() with PGN set, should not be used for destination PGN. This change should work with new and old version of UAPI. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
committed by
Marc Kleine-Budde
parent
314f8a92ae
commit
b8a2fa319a
@@ -241,13 +241,21 @@ static int repeat_address(int sock, uint64_t name)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
uint8_t dat[8];
|
uint8_t dat[8];
|
||||||
|
static const struct sockaddr_can saddr = {
|
||||||
|
.can_family = AF_CAN,
|
||||||
|
.can_addr.j1939 = {
|
||||||
|
.pgn = J1939_PGN_ADDRESS_CLAIMED,
|
||||||
|
.addr = J1939_NO_ADDR,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
memcpy(dat, &name, 8);
|
memcpy(dat, &name, 8);
|
||||||
if (!host_is_little_endian())
|
if (!host_is_little_endian())
|
||||||
bswap(dat, 8);
|
bswap(dat, 8);
|
||||||
if (s.verbose)
|
if (s.verbose)
|
||||||
fprintf(stderr, "- send(, %" PRId64 ", 8, 0);\n", name);
|
fprintf(stderr, "- send(, %" PRId64 ", 8, 0);\n", name);
|
||||||
ret = send(sock, dat, 8, 0);
|
ret = sendto(sock, dat, sizeof(dat), 0, (const struct sockaddr *)&saddr,
|
||||||
|
sizeof(saddr));
|
||||||
if (must_warn(ret))
|
if (must_warn(ret))
|
||||||
error(1, errno, "send address claim for 0x%02x", s.last_sa);
|
error(1, errno, "send address claim for 0x%02x", s.last_sa);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user