[continued from previous message]
<div dir="ltr"><div><div>Right so I was wrong, netcfg reads the domain from here: /tmp/domain_name which is filled by udhcpc default.script<br></div>The patch above won't work alone as we would need udhcpc to write the search domain to a file and
make a read function in netcfg to get the info (or something along those lines)<br><br></div>Here is an updated version of the hack:<br>d-i preseed/early_command string \<br> sed -i 's|printf "\$domain" > /tmp/domain_name|
printf "$search" > /tmp/domain_name|' /etc/udhcpc/default.script; \<br> mv /sbin/udhcpc /sbin/udhcpc.real; \<br> echo '#!/bin/sh' > /sbin/udhcpc; \<br> echo 'exec /bin/busybox udhcpc -O
search "$@"' >> /sbin/udhcpc; \<br> chmod +x /sbin/udhcpc</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Jul 3, 2025 at 12:30 PM Frédéric Guyot <<a href="mailto:
[email protected]">
[email protected]</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here is an updated patch for this issue:
<pre>--- dhcp.c<br>+++ dhcp.c<br>@@ -41,6 +41,7 @@<br> "domain",<br> "hostname",<
"dns",<br>+ "search",<br>
"ntpsrv", /* extra */<br> NULL };<br> <br>@@ -510,7 +511,7 @@<br> * nameservers now so we can do rDNS lookups later to
possibly<br> * find out the domain.<br> */<br>- netcfg_write_resolv(NULL, interface);<br>+ netcfg_write_resolv(NULL, NULL, interface);<br> state = HOSTNAME;<br>
break;<br> <br>@@ -613,7 +614,7 @@<br> netcfg_write_common("", hostname, domain);<br> netcfg_write_loopback();<br> netcfg_write_interface(interface);<
- netcfg_write_resolv(domain, interface);<br>+ netcfg_write_resolv(domain, search, interface);<br> #if !defined(__FreeBSD_kernel__)<br> kill_dhcp_client();<br> #endif<br>
--- static.c<br>+++ static.c<br>@@ -258,14 +258,16 @@<br> return 1;<br> }<br> <br>-int netcfg_write_resolv (const char *domain, const struct netcfg_interface *interface)<br>+int netcfg_write_resolv (const char *domain , const char *search, const
struct netcfg_interface *interface)<br> {<br> FILE* fp = NULL;<br> <br> if ((fp = file_open(RESOLV_FILE, "w"))) {<br> unsigned int i = 0;<br>+ if (search && !empty_str(search))<br>+
fprintf(fp, "search %s\n", search);<br> if (domain && !empty_str(domain))<br>- fprintf(fp, "search %s\n", domain);<br>+ fprintf(fp, "domain %s\n", domain);<br> <br>
for (i = 0; i < NETCFG_NAMESERVERS_MAX; i++)<br> if (!empty_str(interface->nameservers[i]))<br></pre><pre>This should do the trick.<br><br></pre><pre>If someone comes across this issue and this patch hasn't been