]> git.pld-linux.org Git - packages/dhcp.git/blame - dhcp-hwaddress.patch
- updated to 4.4.3-P1
[packages/dhcp.git] / dhcp-hwaddress.patch
CommitLineData
15c1a831
MK
1From 908ea5f3a45a050a878de16d5acde6eda1b77d9f Mon Sep 17 00:00:00 2001
2From: Pavel Zhukov <pzhukov@redhat.com>
3Date: Thu, 21 Feb 2019 10:42:50 +0100
4Subject: [PATCH 20/28] Discover all hwaddress for xid uniqueness
5
6---
7 common/discover.c | 2 ++
8 common/lpf.c | 27 ++++++++++++++++++++++-----
9 includes/dhcpd.h | 3 +++
10 3 files changed, 27 insertions(+), 5 deletions(-)
11
12diff --git a/common/discover.c b/common/discover.c
13index b4b1959..96dcdcf 100644
14--- a/common/discover.c
15+++ b/common/discover.c
16@@ -653,6 +653,8 @@ discover_interfaces(int state) {
17 interface_dereference(&tmp, MDL);
18 tmp = interfaces; /* XXX */
19 }
20+ if (tmp != NULL)
21+ try_hw_addr(tmp);
22
23 if (dhcp_interface_discovery_hook) {
24 (*dhcp_interface_discovery_hook)(tmp);
25diff --git a/common/lpf.c b/common/lpf.c
26index fcaa13d..77a5668 100644
27--- a/common/lpf.c
28+++ b/common/lpf.c
29@@ -713,8 +713,22 @@ ioctl_get_ll(char *name)
30 return sll;
31 }
32
33+// define ?
34+void try_hw_addr(struct interface_info *info){
35+ get_hw_addr2(info);
36+};
37+
38 void
39 get_hw_addr(struct interface_info *info)
40+{
41+ if (get_hw_addr2(info) == ISC_R_NOTFOUND){
42+ log_fatal("Unsupported device type for \"%s\"",
43+ info->name);
44+ }
45+}
46+
47+isc_result_t
48+get_hw_addr2(struct interface_info *info)
49 {
50 struct hardware *hw = &info->hw_address;
51 char *name = info->name;
52@@ -724,7 +738,8 @@ get_hw_addr(struct interface_info *info)
53 int sll_allocated = 0;
54 char *dup = NULL;
55 char *colon = NULL;
56-
57+ isc_result_t result = ISC_R_SUCCESS;
58+
59 if (getifaddrs(&ifaddrs) == -1)
60 log_fatal("Failed to get interfaces");
61
62@@ -808,14 +823,16 @@ get_hw_addr(struct interface_info *info)
63 hw->hbuf[4] = 0xef;
64 break;
65 #endif
66- default:
67- freeifaddrs(ifaddrs);
68- log_fatal("Unsupported device type %hu for \"%s\"",
69- sll->sll_hatype, name);
70+ default:
71+ log_error("Unsupported device type %hu for \"%s\"",
72+ sll->sll_hatype, name);
73+ result = ISC_R_NOTFOUND;
74+
75 }
76
77 if (sll_allocated)
78 dfree(sll, MDL);
79 freeifaddrs(ifaddrs);
80+ return result;
81 }
82 #endif
83diff --git a/includes/dhcpd.h b/includes/dhcpd.h
84index e9e52e7..fabad01 100644
85--- a/includes/dhcpd.h
86+++ b/includes/dhcpd.h
87@@ -2653,7 +2653,10 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
88 #endif
89 const char *print_time(TIME);
90
91+
92 void get_hw_addr(struct interface_info *info);
93+void try_hw_addr(struct interface_info *info);
94+isc_result_t get_hw_addr2(struct interface_info *info);
95 char *buf_to_hex (const unsigned char *s, unsigned len,
96 const char *file, int line);
97 char *format_lease_id(const unsigned char *s, unsigned len, int format,
98--
992.35.1
100
This page took 0.703835 seconds and 4 git commands to generate.