Blame SOURCES/0020-Discover-all-hwaddress-for-xid-uniqueness.patch

df4638
From 01ce61b8a0331a2f068ca2191bfb897b505c1b9d Mon Sep 17 00:00:00 2001
df4638
From: Pavel Zhukov <pzhukov@redhat.com>
df4638
Date: Thu, 21 Feb 2019 10:42:50 +0100
df4638
Subject: [PATCH 20/26] Discover all hwaddress for xid uniqueness
df4638
Cc: pzhukov@redhat.com
df4638
df4638
---
df4638
 common/discover.c |  2 ++
df4638
 common/lpf.c      | 27 ++++++++++++++++++++++-----
df4638
 includes/dhcpd.h  |  3 +++
df4638
 3 files changed, 27 insertions(+), 5 deletions(-)
df4638
df4638
diff --git a/common/discover.c b/common/discover.c
df4638
index 056342c..e66e1c5 100644
df4638
--- a/common/discover.c
df4638
+++ b/common/discover.c
df4638
@@ -648,6 +648,8 @@ discover_interfaces(int state) {
df4638
 			interface_dereference(&tmp, MDL);
df4638
 			tmp = interfaces; /* XXX */
df4638
 		}
df4638
+		if (tmp != NULL)
df4638
+			try_hw_addr(tmp);
df4638
 
df4638
 		if (dhcp_interface_discovery_hook) {
df4638
 			(*dhcp_interface_discovery_hook)(tmp);
df4638
diff --git a/common/lpf.c b/common/lpf.c
df4638
index b732a86..a708a5d 100644
df4638
--- a/common/lpf.c
df4638
+++ b/common/lpf.c
df4638
@@ -699,8 +699,22 @@ ioctl_get_ll(char *name)
df4638
 	return sll;
df4638
 }
df4638
 
df4638
+// define ? 
df4638
+void try_hw_addr(struct interface_info *info){
df4638
+  get_hw_addr2(info);
df4638
+};
df4638
+
df4638
 void
df4638
 get_hw_addr(struct interface_info *info)
df4638
+{
df4638
+  if (get_hw_addr2(info) == ISC_R_NOTFOUND){
df4638
+    log_fatal("Unsupported device type for \"%s\"",
df4638
+              info->name);
df4638
+  }
df4638
+}
df4638
+
df4638
+isc_result_t
df4638
+get_hw_addr2(struct interface_info *info)
df4638
 {
df4638
 	struct hardware *hw = &info->hw_address;
df4638
 	char *name = info->name;
df4638
@@ -710,7 +724,8 @@ get_hw_addr(struct interface_info *info)
df4638
 	int sll_allocated = 0;
df4638
 	char *dup = NULL;
df4638
 	char *colon = NULL;
df4638
-
df4638
+        isc_result_t result = ISC_R_SUCCESS;
df4638
+        
df4638
 	if (getifaddrs(&ifaddrs) == -1)
df4638
 		log_fatal("Failed to get interfaces");
df4638
 
df4638
@@ -794,14 +809,16 @@ get_hw_addr(struct interface_info *info)
df4638
 			hw->hbuf[4] = 0xef;
df4638
 			break;
df4638
 #endif
df4638
-		default:
df4638
-			freeifaddrs(ifaddrs);
df4638
-			log_fatal("Unsupported device type %hu for \"%s\"",
df4638
-				  sll->sll_hatype, name);
df4638
+        default:
df4638
+          log_error("Unsupported device type %hu for \"%s\"",
df4638
+                      sll->sll_hatype, name);
df4638
+          result = ISC_R_NOTFOUND;
df4638
+
df4638
 	}
df4638
 
df4638
 	if (sll_allocated)
df4638
 		dfree(sll, MDL);
df4638
 	freeifaddrs(ifaddrs);
df4638
+        return result;
df4638
 }
df4638
 #endif
df4638
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
df4638
index 0c1a0aa..635c510 100644
df4638
--- a/includes/dhcpd.h
df4638
+++ b/includes/dhcpd.h
df4638
@@ -2637,7 +2637,10 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
df4638
 #endif
df4638
 const char *print_time(TIME);
df4638
 
df4638
+
df4638
 void get_hw_addr(struct interface_info *info);
df4638
+void try_hw_addr(struct interface_info *info);
df4638
+isc_result_t get_hw_addr2(struct interface_info *info);
df4638
 char *buf_to_hex (const unsigned char *s, unsigned len,
df4638
                    const char *file, int line);
df4638
 char *format_lease_id(const unsigned char *s, unsigned len, int format,
df4638
-- 
df4638
2.14.5
df4638