35 lines
1.2 KiB
Diff
35 lines
1.2 KiB
Diff
From 8fda4b4620ca2b23152ca805d14c7cde1083fe31 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
|
Date: Tue, 1 Oct 2019 16:08:28 +0200
|
|
Subject: [PATCH] Report error on dhcp_release
|
|
|
|
If no IPv4 address is present on given interface, the tool would not
|
|
send any request. It would not report any error at the same time. Report
|
|
error if request send failed.
|
|
|
|
Signed-off-by: Petr Mensik <pemensik@redhat.com>
|
|
---
|
|
contrib/lease-tools/dhcp_release.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/contrib/lease-tools/dhcp_release.c b/contrib/lease-tools/dhcp_release.c
|
|
index c866cd9..30e77c6 100644
|
|
--- a/contrib/lease-tools/dhcp_release.c
|
|
+++ b/contrib/lease-tools/dhcp_release.c
|
|
@@ -223,7 +223,11 @@ static struct in_addr find_interface(struct in_addr client, int fd, unsigned int
|
|
ifr->ifr_addr.sa_family = AF_INET;
|
|
if (ioctl(ifrfd, SIOCGIFADDR, ifr) != -1)
|
|
return ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
|
|
- exit(0);
|
|
+ else
|
|
+ {
|
|
+ fprintf(stderr, "error: local IPv4 address not found\n");
|
|
+ exit(1);
|
|
+ }
|
|
}
|
|
else if (h->nlmsg_type == RTM_NEWADDR)
|
|
{
|
|
--
|
|
2.20.1
|
|
|