changeset 5416:1290c8e7ea84 draft

dhcpcd: If using -4 or -6, check we have support for it Better to error early sensibly.
author Roy Marples <roy@marples.name>
date Mon, 03 Aug 2020 16:56:14 +0100
parents 5fae7c5c0f25
children 96a086beb655
files src/if-options.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-options.c	Mon Aug 03 16:55:51 2020 +0100
+++ b/src/if-options.c	Mon Aug 03 16:56:14 2020 +0100
@@ -1207,13 +1207,23 @@
 		ifo->options |= DHCPCD_ONESHOT;
 		break;
 	case '4':
+#ifdef INET
 		ifo->options &= ~DHCPCD_IPV6;
 		ifo->options |= DHCPCD_IPV4;
 		break;
+#else
+		logerrx("INET has been compiled out");
+		return -1;
+#endif
 	case '6':
+#ifdef INET6
 		ifo->options &= ~DHCPCD_IPV4;
 		ifo->options |= DHCPCD_IPV6;
 		break;
+#else
+		logerrx("INET6 has been compiled out");
+		return -1;
+#endif
 	case O_IPV4:
 		ifo->options |= DHCPCD_IPV4;
 		break;