to sync the behavior with ip(7) man page. Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- net/can/j1939/socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index ca85fbce7556..6d09d44c539d 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -751,6 +751,11 @@ static int j1939_sk_sendmsg(struct socket *sock, struct msghdr *msg, /* no address assigned yet */ return -EBADFD; + if (jsk->addr.da == J1939_NO_ADDR && !jsk->addr.dst_name && + !sock_flag(sk, SOCK_BROADCAST)) + /* broadcast, but SO_BROADCAST not set */ + return -EACCES; + /* deal with provided address info */ if (msg->msg_name) { struct sockaddr_can *addr = msg->msg_name; -- 2.20.1