error when interface is not specified

This commit is contained in:
2025-04-03 17:09:25 +02:00
parent e3097eec3a
commit 6baf639a9c

6
main.c
View File

@@ -206,6 +206,12 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
// Check if the interface is specified
if (dev_name == NULL) {
fprintf(stderr, "Error: Interface must be specified\n");
return 1;
}
// Resolve the destination address // Resolve the destination address
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6 hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6