diff --git a/ip/ipaddress.c b/ip/ipaddress.c index fd79f978..1b8ab783 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -2249,7 +2249,10 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) } else if (strcmp(*argv, "home") == 0) { ifa_flags |= IFA_F_HOMEADDRESS; } else if (strcmp(*argv, "nodad") == 0) { - ifa_flags |= IFA_F_NODAD; + if (req.ifa.ifa_family == AF_INET6) + ifa_flags |= IFA_F_NODAD; + else + fprintf(stderr, "Warning: nodad option can be set only for IPv6 addresses\n"); } else if (strcmp(*argv, "mngtmpaddr") == 0) { ifa_flags |= IFA_F_MANAGETEMPADDR; } else if (strcmp(*argv, "noprefixroute") == 0) {