From nobody Sun May 18 16:40:34 2025 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4b0mlQ05kdz5wSqj for ; Sun, 18 May 2025 16:40:34 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b0mlP6bQwz42xD for ; Sun, 18 May 2025 16:40:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747586433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2yjSFBFROe9g8tFfyp9OQkGhmViNvkh6vdEu894LXLo=; b=SVWf6Bh/WSMeOv373CD9C3wn6sO5dANZyrI+GJvU1TRM1diaWTkpFI6q0WJCa3NHV3MqpY OdHdszPBo9q8He5sv4HHE16GXPtKB1kn8qjTmqpeQRPYP97ph5Jz+wzVuVVl6DKvzfbcvP iLMqcv4W2hjZQv36FzLGge/lu310wI0d8a7hz3bb8ccpgPtSXZvseGj6FdS7EBjD3HAIEL kIx5wYTNfK3X2d7ZqOXu/TXELRCQm8mvLnLiCJEqaK2OIk1cZ3Qf4IPWFWApj5NAykYaAT 3P/gz+sj+bMz7ysxKmWPFjk43v69pkmpMyq3avW/W0ebHsDAp/jwb10+YxiMIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747586433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2yjSFBFROe9g8tFfyp9OQkGhmViNvkh6vdEu894LXLo=; b=xCI0+oq4tUVFk+kNI+tS98GG3t8CMar6NaXQMOZMHaZA5ZbpcaVsGyw4mHlEXrZKvOrahE JCCCuCxUV8dM6cMh3OxW5lEtwB+kDXOQVntL00AOF0uDcU/L8viZUd6Ca4uqFCQ027N5LW igXXtAB/eOyei9Z0J1uydfqR7Y4MNjsKDWdWYGjEEXpjFX9jEzriiMQMgyjPfVkt0Ly5aH c1kb8WoYnM2J2JdSv0bGApvxOIHxSUcIc3El13976QYLRZuVzPq0rBxaVGhAl4Ume2zZLi /pMG7wQUW1VRc95jp9YAr8nrAD6vGBh3p8DJ4WYk/fsY1BeUTLKMsfjqeSSL1w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747586433; a=rsa-sha256; cv=none; b=B1lbVCR3WeEaDQaLtORDR+NJTtm/5NMlcpy4psAxsV/X8qOomLLRrD9cnlrurpxKf2o8IO QwlkUGZb90YRD2HohMH6B2qAh+hxSeRgoMoL/SVuvT8+3IA40xbvQDd9JClcxSkEXfNaY6 Nt5CqkEwcsBPpDFlMkivdNtznqHnyb022eIC8BqBmeN6mY55ZADGzgZajfoS0c0s+muXy9 jq3ujO9gHZzCIWaZUt0w/TpKx2iPvu8Q+aO9di/ce9KYV/cLRYimrnxY/zvb/Jx3dGRmrY koDh0QOp9HaiatTCLMjySDOBkU7/L2aYo5xoB/Zar5s6Vbt/X6Egh9/w0QWm5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4b0mlP629Lz9jv for ; Sun, 18 May 2025 16:40:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 54IGeXsf099837 for ; Sun, 18 May 2025 16:40:33 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 54IGeXYD099836 for bugs@FreeBSD.org; Sun, 18 May 2025 16:40:33 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 286910] ifconfig(8) crashes when using "netmask" instead of "prefixlen" for inet6 deletion Date: Sun, 18 May 2025 16:40:34 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: hayzam@alchemilla.io X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D286910 Bug ID: 286910 Summary: ifconfig(8) crashes when using "netmask" instead of "prefixlen" for inet6 deletion Product: Base System Version: 14.2-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: hayzam@alchemilla.io When attempting to delete an inet6 address using ifconfig on FreeBSD, if the netmask keyword is mistakenly used in place of prefixlen, ifconfig crashes = with a segmentation fault. Although this is a misuse of syntax, the utility shou= ld gracefully handle the error and return a usage or invalid argument error ra= ther than crashing. Steps to reproduce: 1) Add an IPv6 address: ifconfig lo0 inet6 2001:db8::1234/64 2) Try to delete it using the wrong keyword: ifconfig lo0 inet6 2001:db8::1234 netmask 64 delete Expected result: ifconfig should reject the unsupported netmask keyword for IPv6 with an err= or message and exit non-zero or treat it exactly like prefixlen? Actual result: ifconfig crashes with: Program received signal SIGSEGV, Segmentation fault. Address not mapped to object. in6_getaddr (addr_str=3D"64", which=3D2) at af_inet6.c:431 431 px->set =3D true; System version: FreeBSD bsd-box 14.2-RELEASE-p1 FreeBSD 14.2-RELEASE-p1 GENERIC amd64 Notes: Using the correct syntax works as expected: ifconfig lo0 inet6 2001:db8::1234 prefixlen 64 delete This appears to be a missing parser alias for netmask =E2=86=92 prefixlen i= n the IPv6 command table. Patch: Please see the following patch, which simply adds a netmask alias so that I= Pv6 treats it identically to prefixlen, preventing the NULL-deref: --- af_inet6.c.orig 2025-05-18 19:43:25.886739000 +0400 +++ af_inet6.c 2025-05-18 19:43:31.009653000 +0400 @@ -693,6 +693,7 @@ static struct cmd inet6_cmds[] =3D { DEF_CMD_ARG("prefixlen", setifprefixlen), + DEF_CMD_ARG("netmask", setifprefixlen), DEF_CMD("anycast", IN6_IFF_ANYCAST, setip6flags), DEF_CMD("tentative", IN6_IFF_TENTATIVE,setip6flags), DEF_CMD("-tentative", -IN6_IFF_TENTATIVE,setip6flags), This patch has been tested on 14.2-RELEASE-p1 and prevents the segfault wit= hout altering any other behavior. --=20 You are receiving this mail because: You are the assignee for the bug.=