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: Enable mDNS lookups via NSS when e...



details:   https://anonhg.NetBSD.org/src/rev/1a16a69cf38c
branches:  trunk
changeset: 366133:1a16a69cf38c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun May 15 16:38:25 2022 +0000

description:
sysinst: Enable mDNS lookups via NSS when enabling mdnsd.

Add/remove "multicast_dns" to the hosts: line in /etc/nsswitch.conf when
toggling the mdnsd rcvar. Change the label from "Enable mdnsd" to "Enable
multicast DNS support" to better describe what's going on here.

Now when you enable multicast DNS support in the installer, the host will
both advertise itself on the network and resolve .local network names.

diffstat:

 usr.sbin/sysinst/configmenu.c |  36 ++++++++++++++++++++++++++++++++++--
 usr.sbin/sysinst/msg.mi.en    |   4 ++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diffs (82 lines):

diff -r bdf8eae455b9 -r 1a16a69cf38c usr.sbin/sysinst/configmenu.c
--- a/usr.sbin/sysinst/configmenu.c     Sun May 15 16:25:09 2022 +0000
+++ b/usr.sbin/sysinst/configmenu.c     Sun May 15 16:38:25 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.15 2022/04/21 17:30:15 martin Exp $ */
+/* $NetBSD: configmenu.c,v 1.16 2022/05/15 16:38:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@
 static void config_list_init(void);
 static void get_rootsh(void);
 static int toggle_rcvar(struct menudesc *, void *);
+static int toggle_mdnsd(struct menudesc *, void *);
 static void configmenu_hdr(struct menudesc *, void *);
 static int check_root_password(void);
 
@@ -100,7 +101,7 @@
        {MSG_enable_sshd, CONFIGOPT_SSHD, "sshd", toggle_rcvar, NULL},
        {MSG_enable_ntpd, CONFIGOPT_NTPD, "ntpd", toggle_rcvar, NULL},
        {MSG_run_ntpdate, CONFIGOPT_NTPDATE, "ntpdate", toggle_rcvar, NULL},
-       {MSG_enable_mdnsd, CONFIGOPT_MDNSD, "mdnsd", toggle_rcvar, NULL},
+       {MSG_enable_mdnsd, CONFIGOPT_MDNSD, "mdnsd", toggle_mdnsd, NULL},
        {MSG_enable_xdm, CONFIGOPT_XDM, "xdm", toggle_rcvar, NULL},
        {MSG_enable_cgd, CONFIGOPT_CGD, "cgd", toggle_rcvar, NULL},
        {MSG_enable_lvm, CONFIGOPT_LVM, "lvm", toggle_rcvar, NULL},
@@ -455,6 +456,37 @@
        return 0;
 }
 
+static int
+toggle_mdnsd(struct menudesc *menu, void *arg)
+{
+       configinfo **confp = arg;
+       int s;
+       const char *setting, *varname;
+
+       varname = confp[menu->cursel]->rcvar;
+
+       s = check_rcvar(varname);
+
+       /* we're toggling, so invert the sense */
+       if (s) {
+               confp[menu->cursel]->setting = MSG_NO;
+               setting = "files dns";
+       } else {
+               confp[menu->cursel]->setting = MSG_YES;
+               setting = "files multicast_dns dns";
+       }
+
+       if (logfp) {
+               fprintf(logfp, "setting hosts: %s\n", setting);
+               fflush(logfp);
+       }
+       replace("/etc/nsswitch.conf", "s/^hosts:.*/hosts:\t\t%s/", setting);
+
+       toggle_rcvar(menu, arg);
+
+       return 0;
+}
+
 static void
 configmenu_hdr(struct menudesc *menu, void *arg)
 {
diff -r bdf8eae455b9 -r 1a16a69cf38c usr.sbin/sysinst/msg.mi.en
--- a/usr.sbin/sysinst/msg.mi.en        Sun May 15 16:25:09 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.en        Sun May 15 16:38:25 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.38 2022/04/21 17:30:15 martin Exp $      */
+/*     $NetBSD: msg.mi.en,v 1.39 2022/05/15 16:38:25 jmcneill Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1158,7 +1158,7 @@
 message enable_sshd {Enable sshd}
 message enable_ntpd {Enable ntpd}
 message run_ntpdate {Run ntpdate at boot}
-message enable_mdnsd {Enable mdnsd}
+message enable_mdnsd {Enable multicast DNS support}
 message enable_xdm {Enable xdm}
 message enable_cgd {Enable cgd}
 message enable_lvm {Enable lvm}



Home | Main Index | Thread Index | Old Index