Do not fail if interface doesn't have hwaddr (#1632246)
This commit is contained in:
parent
dee6f0c9de
commit
ba9bdacde1
@ -7,7 +7,80 @@ index 26a78ca..ed01e45 100644
|
||||
tmp = interfaces; /* XXX */
|
||||
}
|
||||
+ if (tmp != NULL)
|
||||
+ get_hw_addr(tmp);
|
||||
+ try_hw_addr(tmp);
|
||||
|
||||
if (dhcp_interface_discovery_hook) {
|
||||
(*dhcp_interface_discovery_hook)(tmp);
|
||||
diff --git a/common/lpf.c b/common/lpf.c
|
||||
index 4a252ca..467b055 100644
|
||||
--- a/common/lpf.c
|
||||
+++ b/common/lpf.c
|
||||
@@ -697,8 +697,22 @@ ioctl_get_ll(char *name)
|
||||
return sll;
|
||||
}
|
||||
|
||||
+// define ?
|
||||
+void try_hw_addr(struct interface_info *info){
|
||||
+ get_hw_addr2(info);
|
||||
+};
|
||||
+
|
||||
void
|
||||
get_hw_addr(struct interface_info *info)
|
||||
+{
|
||||
+ if (get_hw_addr2(info) == ISC_R_NOTFOUND){
|
||||
+ log_fatal("Unsupported device type for \"%s\"",
|
||||
+ info->name);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+isc_result_t
|
||||
+get_hw_addr2(struct interface_info *info)
|
||||
{
|
||||
struct hardware *hw = &info->hw_address;
|
||||
char *name = info->name;
|
||||
@@ -708,7 +722,8 @@ get_hw_addr(struct interface_info *info)
|
||||
int sll_allocated = 0;
|
||||
char *dup = NULL;
|
||||
char *colon = NULL;
|
||||
-
|
||||
+ isc_result_t result = ISC_R_SUCCESS;
|
||||
+
|
||||
if (getifaddrs(&ifaddrs) == -1)
|
||||
log_fatal("Failed to get interfaces");
|
||||
|
||||
@@ -792,14 +807,16 @@ get_hw_addr(struct interface_info *info)
|
||||
hw->hbuf[4] = 0xef;
|
||||
break;
|
||||
#endif
|
||||
- default:
|
||||
- freeifaddrs(ifaddrs);
|
||||
- log_fatal("Unsupported device type %hu for \"%s\"",
|
||||
- sll->sll_hatype, name);
|
||||
+ default:
|
||||
+ log_error("Unsupported device type %hu for \"%s\"",
|
||||
+ sll->sll_hatype, name);
|
||||
+ result = ISC_R_NOTFOUND;
|
||||
+
|
||||
}
|
||||
|
||||
if (sll_allocated)
|
||||
dfree(sll, MDL);
|
||||
freeifaddrs(ifaddrs);
|
||||
+ return result;
|
||||
}
|
||||
#endif
|
||||
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
|
||||
index d534f8c..66a21fb 100644
|
||||
--- a/includes/dhcpd.h
|
||||
+++ b/includes/dhcpd.h
|
||||
@@ -2591,7 +2591,10 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
|
||||
#endif
|
||||
const char *print_time(TIME);
|
||||
|
||||
+
|
||||
void get_hw_addr(struct interface_info *info);
|
||||
+void try_hw_addr(struct interface_info *info);
|
||||
+isc_result_t get_hw_addr2(struct interface_info *info);
|
||||
char *buf_to_hex (const unsigned char *s, unsigned len,
|
||||
const char *file, int line);
|
||||
char *format_lease_id(const unsigned char *s, unsigned len, int format,
|
||||
|
@ -1,46 +0,0 @@
|
||||
diff --git a/server/confpars.c b/server/confpars.c
|
||||
index d79489b..c20d618 100644
|
||||
--- a/server/confpars.c
|
||||
+++ b/server/confpars.c
|
||||
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
|
||||
|
||||
cfile = (struct parse *)0;
|
||||
#if defined (TRACING)
|
||||
+ // No need to dmalloc huge memory region if we're not going to re-play
|
||||
+ if (!trace_playback()){
|
||||
+ status = new_parse(&cfile, file, NULL, 0, filename, 0);
|
||||
+ goto noreplay;
|
||||
+ };
|
||||
flen = lseek (file, (off_t)0, SEEK_END);
|
||||
if (flen < 0) {
|
||||
boom:
|
||||
@@ -174,6 +179,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
|
||||
#else
|
||||
status = new_parse(&cfile, file, NULL, 0, filename, 0);
|
||||
#endif
|
||||
+ noreplay:
|
||||
if (status != ISC_R_SUCCESS || cfile == NULL)
|
||||
return status;
|
||||
|
||||
diff --git a/server/confpars.c b/server/confpars.c
|
||||
index 3aecd05..5be4ab1 100644
|
||||
--- a/server/confpars.c
|
||||
+++ b/server/confpars.c
|
||||
@@ -176,6 +176,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
|
||||
if (trace_record ())
|
||||
trace_write_packet (ttype, ulen + tflen + 1, dbuf, MDL);
|
||||
status = new_parse(&cfile, -1, fbuf, ulen, filename, 0); /* XXX */
|
||||
+ dfree(dbuf, MDL);
|
||||
#else
|
||||
status = new_parse(&cfile, file, NULL, 0, filename, 0);
|
||||
#endif
|
||||
@@ -188,9 +189,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
|
||||
else
|
||||
status = conf_file_subparse (cfile, group, group_type);
|
||||
end_parse (&cfile);
|
||||
-#if defined (TRACING)
|
||||
- dfree (dbuf, MDL);
|
||||
-#endif
|
||||
return status;
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ Patch41: dhcp-4.3.6-isc-util.patch
|
||||
Patch42: dhcp-4.3.6-options_overflow.patch
|
||||
Patch43: dhcp-4.3.6-reference_count_overflow.patch
|
||||
Patch44: dhcp-iface_hwaddr_discovery.patch
|
||||
Patch45: dhcp-noreplay.patch
|
||||
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -355,9 +354,6 @@ rm bind/bind.tar.gz
|
||||
# https://bugzilla.redhat.com/1163379
|
||||
%patch44 -p1 -b .xid-hwaddr
|
||||
|
||||
#ISC Bugs #48110
|
||||
%patch45 -p1 -b .noreplay
|
||||
|
||||
# DHCLIENT_DEFAULT_PREFIX_LEN 64 -> 128
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=656610
|
||||
sed -i -e 's|DHCLIENT_DEFAULT_PREFIX_LEN 64|DHCLIENT_DEFAULT_PREFIX_LEN 128|g' includes/site.h
|
||||
@ -681,8 +677,8 @@ done
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Aug 30 2018 Pavel Zhukov <pzhukov@redhat.com> - 12:4.3.6-28
|
||||
- Do not try to map leases file in memory if not in replay mode
|
||||
* Mon Sep 24 2018 Pavel Zhukov <pzhukov@redhat.com> - 12:4.3.6-28
|
||||
- Resolves: 1632246 - Do not fail if iface has no hwaddr
|
||||
|
||||
* Fri Jul 13 2018 Petr Menšík <pemensik@redhat.com> - 12:4.3.6-27
|
||||
- Update to bind 9.11.4
|
||||
|
Loading…
Reference in New Issue
Block a user