NetBSD Problem Report #57989

From www@netbsd.org  Sun Mar  3 03:45:29 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8C8071A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  3 Mar 2024 03:45:29 +0000 (UTC)
Message-Id: <20240303034528.8F8BD1A923B@mollari.NetBSD.org>
Date: Sun,  3 Mar 2024 03:45:28 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: sysinst parses `route -n show' output and sometimes feeds back input route(8) doesn't like
X-Send-Pr-Version: www-1.0

>Number:         57989
>Category:       install
>Synopsis:       sysinst parses `route -n show' output and sometimes feeds back input route(8) doesn't like
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 03 03:50:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The RouteBSD Installation
>Environment:
>Description:
sysinst(8) parses the output of `route -n show' to get a default default route suggestion:

    648 			/*
    649 			 * Extract default route from output of
    650 			 * 'route -n show'
    651 			 */
    652 			if (collect(T_OUTPUT, &textbuf,
    653 			    "/sbin/route -n show | "
    654 			    "while read dest gateway flags;"
    655 			    " do [ \"$dest\" = default ] && {"
    656 			    " echo \"$gateway\"; break; };"
    657 			    " done" ) > 0)
    658 				strlcpy(net_defroute, textbuf,
    659 				    sizeof net_defroute);
    660 			free(textbuf);
    661 			if ((nline = strchr(net_defroute, '\n')))
    662 				*nline = '\0';

https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/net.c#648

When there's no gateway, and we only have link-local configuration, it sometimes comes up with net_defroute set to `link#1'.  But route(8) doesn't like it when that is passed back in later:

    883 		run_program(RUN_DISPLAY | RUN_PROGRESS,
    884 				"/sbin/route -n add default %s", net_defroute);

https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/net.c#883

This causes route(8) to fail:

     Status: Command failed
    Command: /sbin/route -n add default link#1
     Hit enter to continue
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
route: link#1: bad value

Fortunately, it is an apparently harmless failure; it doesn't prevent the installation from proceeding and downloading from link-local addresses.
>How-To-Repeat:
run sysinst on a network with no DHCP server or IPv6 SLAAC or anything, just link-local configuration
>Fix:
Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.