From eugen@freebsd.org Sat Oct 28 16:07:43 2023 X-Original-To: freebsd-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 4SHkvp0l4gz500V2 for ; Sat, 28 Oct 2023 16:07:50 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (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 (2048 bits) client-digest SHA256) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SHkvn1tnjz3QQb for ; Sat, 28 Oct 2023 16:07:49 +0000 (UTC) (envelope-from eugen@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=softfail (mx1.freebsd.org: 2a01:4f8:c2c:26d8::2 is neither permitted nor denied by domain of eugen@freebsd.org) smtp.mailfrom=eugen@freebsd.org; dmarc=none Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.17.1/8.17.1) with ESMTPS id 39SG7l6r000105 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sat, 28 Oct 2023 16:07:47 GMT (envelope-from eugen@freebsd.org) X-Envelope-From: eugen@freebsd.org X-Envelope-To: Received: from [10.58.0.11] (dadvw [10.58.0.11] (may be forged)) by eg.sd.rdtc.ru (8.17.1/8.17.1) with ESMTPS id 39SG7j3R065028 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 28 Oct 2023 23:07:45 +0700 (+07) (envelope-from eugen@freebsd.org) From: Eugene Grosbein Subject: netif userland API To: "freebsd-net@freebsd.org" Message-ID: Date: Sat, 28 Oct 2023 23:07:43 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 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 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT autolearn=disabled version=3.4.6 X-Spam-Report: * -0.0 SHORTCIRCUIT No description available. * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hz.grosbein.net X-Spamd-Result: default: False [-2.46 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.76)[-0.758]; NEURAL_HAM_MEDIUM(-0.61)[-0.606]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; TO_DN_EQ_ADDR_ALL(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; R_SPF_SOFTFAIL(0.00)[~all]; FREEFALL_USER(0.00)[eugen]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DOM_EQ_FROM_DOM(0.00)[] X-Rspamd-Queue-Id: 4SHkvn1tnjz3QQb X-Spamd-Bar: -- Hi! Assume we run some FreeBSD-based broadband remote access server for PPPoE (net/mpd5 for example). The server has hundreds or thousands vlan interfaces and even more ngXXX interfaces, one per user PPPoE session. The server software may need to enable its PPPoE service for all newly created vlans over another "physical" parent interface just configured in addition to already running ones. I see no effective userland API for the software to list vlan interfaces under specific parent one. The only option I see is getifaddrs(3) function to get list of ALL interfaces in the system then iterate over the list calling ioctl SIOCGETVLAN and if there is no error, compare returned vlr_parent name with the name of needed parent interface. Not efficient at all, while serving new PPPoE connection attempts simultaneously, collecting traffic stats for RADIUS accounting etc. Do I miss something? Eugene