Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst sysinst: Write custom hostname to rc.conf w...



details:   https://anonhg.NetBSD.org/src/rev/cfa3308dd6aa
branches:  trunk
changeset: 366137:cfa3308dd6aa
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun May 15 17:42:32 2022 +0000

description:
sysinst: Write custom hostname to rc.conf when using DHCP

If the user changes the suggested hostname from DHCP, ensure that the
new hostname is written to rc.conf by clearing the appropriate
DHCPCONF_* flags.

diffstat:

 usr.sbin/sysinst/net.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 709a1d749a88 -r cfa3308dd6aa usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Sun May 15 17:02:37 2022 +0000
+++ b/usr.sbin/sysinst/net.c    Sun May 15 17:42:32 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.41 2022/05/15 17:02:37 jmcneill Exp $        */
+/*     $NetBSD: net.c,v 1.42 2022/05/15 17:42:32 jmcneill Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -493,6 +493,7 @@
        int  pid, status;
        char **ap, *slcmd[10], *in_buf;
        char buffer[STRSIZE];
+       char hostname[MAXHOSTNAMELEN + 1];
        struct statvfs sb;
        struct net_desc net_devs[MAX_NETS];
        menu_ent *net_menu;
@@ -657,10 +658,14 @@
         * discovered on the network may not match the desired values
         * for the target system.
         */ 
+       strlcpy(hostname, recombine_host_domain(), MAXHOSTNAMELEN);
        msg_prompt_add(MSG_net_host, net_host, net_host,
            sizeof net_host);
        msg_prompt_add(MSG_net_domain, net_domain, net_domain,
            sizeof net_domain);
+       if (strcmp(hostname, recombine_host_domain()) != 0) {
+               net_dhcpconf &= ~(DHCPCONF_DOMAIN|DHCPCONF_HOST);
+       }
 
        if (!dhcp_config) {
                /* Manually configure IPv4 */



Home | Main Index | Thread Index | Old Index