From nobody Thu Nov 13 17:42:54 2025 X-Original-To: net@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 4d6nfp29NPz6HBVj for ; Thu, 13 Nov 2025 17:42:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d6nfp1bzHz3ntm for ; Thu, 13 Nov 2025 17:42:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763055778; 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:autocrypt:autocrypt; bh=EomaTvcmfhMX4FwTNa5FRnhVfiQJ285f2YUfelDBpLw=; b=iFeKvh/JWzxghscg3+oBDqJ+K+oJqd1Mg57yrMdRUt+5YqmkPJDhycDbgY035YQ/+8MI73 YxTXaVV6lfQ2qGxcHdQFIvIZTGUY+g/xv8bOhECGpCoG/ztOdILo0IaOlMnosE+k+xcEjv nCsOLv/reylCCkJYocO9UWVuXeja2L71VyqDhXdIE8h5Hn+FmnxLo4zonYQmp3y6iqnrSu 4IX8AFV5R0VhwBSeNKtkj2B0tWvXGk1k8AW/cJUtuUGJT4a3F7ekKzu5B/lSbb2LEPwda3 jvFqkrn0nsnbq+JGo19H3IwzyJ1RbI0CS3KWOZIHzJVw9tsZrjE8B+uL1fBHSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763055778; 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:autocrypt:autocrypt; bh=EomaTvcmfhMX4FwTNa5FRnhVfiQJ285f2YUfelDBpLw=; b=mfSPYm6zbdvxB0FBOlSPMW6ZDPhS3K6WZ5Pn5kNtWoTPfn23Vys6woqDh06csn3r0vtn/Z 0UZf0DYkLZElH68f8bNoUqFRDRedwGtBF7SxM+8Ith2FBpMHABvucbVJlTxBTArFY4+v4X xSGcsyiaNrebYKdS/2QmCMnnbS8lWGzbzC6tukXUuUBT2gDfxqbHKB7kX2lK4OxfdPlxV9 v5qVV34kRTGTQnkIpfS/dR1XVcK9azp2YEk6mxHaWYvBkk5uwKbykQ+DyPMWM+ApMDfz0P U+xeymZ1KVhP1zDhAuSRnqg+ZpblpnQet35i2o8QlfBmtuQdyNKybshNJ1KTLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763055778; a=rsa-sha256; cv=none; b=D2IRvhg57q56KGLBifwktaBRxMs5tcaI5YZDiz+NwDyQQfOuNnyZp8+h7kLVg7doAMWxZ2 0HdJtchX3Su8sU9/xr4TBWhKlJ5I1aNgHPqvWXKPdB3veMUrZk6l3oIvLGlaYvHwrJx2SJ 6e6MqjGLKZYcaq1fpzsFDgVKF45yD61RP+QtDHoOOe8t4hKumxI6YSP9vUKtmGQkD5K4p5 PKZw5Ejwa9lQd0zarG+RymTYcqizDf3F+jd4/WtZpVlYre2dYaFirsNasd1ISjYN5LkPxQ sRaHO5G7uSOVXztUTfs6YxeEW3HSt9P29myggiI7Bs5yxS2LiFHiYvCetZGgHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [192.168.0.88] (unknown [93.188.39.137]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4d6nfn6WyKz2WY for ; Thu, 13 Nov 2025 17:42:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Message-ID: Date: Thu, 13 Nov 2025 19:42:54 +0200 List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: net@FreeBSD.org From: Andriy Gapon Subject: setting ip address removes / replaces first of aliases Autocrypt: addr=avg@FreeBSD.org; keydata= xsDNBGcKrHEBDADRvwQOK0b/yo4ys5cs6bOQMhEh4xtfbaZ/CU00cpPgUip3sOZCdrtMWlRC g25z97prxE9pKueZi+HXDhIPpa9xl14ghqF4oYScuJ1i18HyiOH2y5Q3Vv/TtFiSzicd3EAu QgS3jVidpgDSPDdj2Yz3UxYpZ+PuFl6nOnvCvqOFcjUlzKCyPaiN2b86l1Nscmhnc+zQ/faB erUOEFEDQbWMA5YfXi8HrbeR16hfRfGt7E0aMDlIj9FIPIq71UWMN9CimPgs4+rbNr1MAlLa z4GxSDhVYZEY5rqtCzr+PLXboRQWnaUwXl0/biw9enf17NHdYv1SNAFTX2eC4dZ3qBVI74dS PgNprm+PMfz+6Hhs/dAv+Nan5nVhg3EFIjYTiy0MnjMSq8uI0v0ykpAGAcJJ5xl6d23aLxgN 6f0z6pJRCO0hGPgU7UzvFD0MxJxmbzqdT1R51KDan1oD41b+tjl2LMBuCDCoB0U44Pu0zLdp xMfFTxCXtwIYKIUxwd28jwMAEQEAAc0eQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+ wsENBBMBCAA3FiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHEFCQeEzgACGwMECwkIBwUV CAkKCwUWAgMBAAAKCRDMM63k0uPru5tSDACFK15LLbq89RSQ6QMnjiIm1t/wYJyumb519MH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MFCQeEzgACGwwACgkQzDOt 5NLj67sUCAv5AXqgWnYN9EblapMbZjkiqL8pZQ0GNqh+Pg9FwbyULxjtRTO6rD4D0IxizByb ef+neeUNyYlagt5nfKMysEr0SU/gHKCi8vyTF/63ukMrGUNGmJJxrndl5ZYKC6j6eX7twrZF L1Uvlmn6FnQ22red5kHO93fDjG4zaDIZvHfwj7kzjZ4tpC7Byinf88s14mdZeScc0PnU2hj4 UGYju/wg2FF4YxaZYhcmdTiRYY0Wx85XSMZv19pnn78sadEuRvfRd4JTmw++j1xGXeqQGWzz /CTG5/Ex9GAkQ02hZbmi236byDXoet4G8TEyOph9QFVkV9bNd0jQZaFZPGEj4PSPUYGAF7s5 xJaNGgctC3aZ7WjEv1FBoo44XCU4xcjJ1wZQUrHxRhx6TW0Jtcl0U9qfKFW30TSPo6RyiXuj X4ltWKAtjoXB8nUmEJckaz7IRu2b4pXDeazZuz5JBygUs10yJjDxh2vFQZo0KaBAPx9MZlPn gpPTjT15L8xGftEjQXF6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I've just been toying with IP configurations and made a curious (but not very surprising observation). If I set an IP address on an interface, then add a bunch of aliases, then remove the original IP address and then finally set it again, then the first of the aliases gets removed. This is not surprising because after removing the original IP address, the first of the aliases becomes kind of _the_ IP address. That's because all interface addresses are equal regardless of whether an address was set or added (in other words, there is no "the" address). So, when the original address is set again, it replaces(*) what was the first alias. It's basically just the semantics of those operations. Setting an address replaces the first of already present addresses, if any. Adding an alias just appends another address. But in a sense this is curious because the behavior breaks imaginary distinction between the main address and the aliases. One might have expected that removing and then setting again the main address would not affect the aliases. In summary, I think that the replacement behavior makes perfect sense when there is only one address on an interface. But with multiple addresses it's not clear that setting an address is intended to replace whatever happens to be the first of the present addresses. And if we do the replacement then it better be the in-place replacement unlike what we actually do now. That is, the new address should be the first in the list. (*) -- from what I can see, it's not exactly an in-place replacement, it's remove the first of the existing addresses and append the new one. P.S. Just in case, my terminology: setting an address: ifconfig $if a.b.c.d adding an alias: ifconfig $if alias a.b.c.d removing an address: ifconfig $if -alias a.b.c.d -- Andriy Gapon