summaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'net/can')
-rw-r--r--net/can/can_socketcan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
index 92b1f79385..4b68f60c6b 100644
--- a/net/can/can_socketcan.c
+++ b/net/can/can_socketcan.c
@@ -194,6 +194,11 @@ static void can_host_socketcan_connect(CanHostState *ch, Error **errp)
struct sockaddr_can addr;
struct ifreq ifr;
+ if (!c->ifname) {
+ error_setg(errp, "'if' property not set");
+ return;
+ }
+
/* open socket */
s = qemu_socket(PF_CAN, SOCK_RAW, CAN_RAW);
if (s < 0) {