From nobody Tue Apr 02 14:37:01 2024 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 4V89Sc0xFNz5Gkdj for ; Tue, 2 Apr 2024 14:37:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V89Sb6y6gz4Fft for ; Tue, 2 Apr 2024 14:37:03 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712068624; a=rsa-sha256; cv=none; b=OQYd2K0m9OQAFWHvBCGuUwl1qA332pnTOx0xiYLQouK+1vxHLBOxbzFccFkD+B8LmjwTw6 BVSMwh/IuYQrvuusF9WEBv521WxFIYQpPF4O0vUSvroJ26qo6yoCSL9K6JlouBZouedN1e rlDE8SlrSlBL9CcRWEl64NZkk2nT9cHxyiceOOYBeRv+8/asupv1+Ifwqmxr3fcnorgaqZ I+u7yeDioAI3aubcnXdvqiWdX53xxsjGvP7TNs4bzGRMqR38G1KUhsnXz3Yh02DOzsIHYU H0+s3YzHFUqzNOfZOy6EwT7/v6lh7f1Utz8XRlsJVw0Tyh8UykOslddvVQ1I3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712068624; 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=6sU9KkL4/EzyCj1psLZzkK/iT5NwraC9EGtUL+kNePk=; b=ehpdLCRW8IkfGXYciDGSOUh4fPA8rfFZUHoIHkMUV6e6I8efnmECpXbC7imgdmHbirjDLv D24F0bFX2iwGcjQD9n3vZQfO5npgunaAEhwQahh6o+8wmM8XqvqhD99VL58d23HH4cuvjx dJ0G4njQHicm9NkBp9SSoNSPXGr3i7QpOT9tc8OQ3JichEUN10ck8mqwrQmF6X/R5usM30 2kc/OlaF2RFxot/etODtotkMAoTXFgjgMBe4S8hP9e5q8K/VNB4Xc2pDz/excXu6DoU34G pHA+n0bMGbQxlBJPQv6v2SUIxJDEpsWQ2qI4RAZ+DyzJAZCyc2GtXX0DgkTuVg== 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 4V89Sb6Yk2ztGh for ; Tue, 2 Apr 2024 14:37:03 +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 432Eb3KO026993 for ; Tue, 2 Apr 2024 14:37:03 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 432Eb3k9026987 for bugs@FreeBSD.org; Tue, 2 Apr 2024 14:37:03 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 278130] [netgraph][patch] ng_bridge hooks should auto assign number for [up]link Date: Tue, 02 Apr 2024 14:37:01 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dave@freedave.net 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 attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3D278130 Bug ID: 278130 Summary: [netgraph][patch] ng_bridge hooks should auto assign number for [up]link Product: Base System Version: 14.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: dave@freedave.net Created attachment 249661 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D249661&action= =3Dedit patches and example ngctl for testing The removal of NG_BRIDGE_MAX_LINKS in review D21803 has made it possible to have way more than 32 connections to an ng_bridge. But there isn't any (eas= y) way for userland to track available link names and requires listing all existing [up]links or to just guess a number until one succeeds. There appears to never be a need to know the link number of the hook on the ng_bridge. When an ng_bridge shuts down it disconnects all hooks. If you kn= ow the path of your ng_eiface, ng_socket, ng_ether, etc. you have a way to `rmhook` without the link path. That is you can remove via either: rmhook [up]linkX or with rmhook ether Everything else that connects to ng_bridge has a similar option. This change, however, is about removing the need to specify an [up]link num= ber when creating a connection to the ng_bridge. Using ng_eiface again it means you can use: connect ether link The ng_bridge will auto assign the lowest available [up]link number that is valid. The number space for [up]link is as large as an int, limited by the fact th= at all netgraph nodes use an int to track the number of connected hooks they h= ave, nd_numhooks in struct ng_node. This turns out to be a convenient fact when introducing unr(9) as I can just initialize to INT_MAX. But it also means y= ou could just take advantage of that and create a numbering scheme in user spa= ce. For example: 0,1 always reserved for ng_ether (which requires 2 hooks) 16 - N reserved for bhyve N - INT_MAX reserved for jails The only issue is that 3rd party scripts would have to agree (e.g. ezjail, vm-bhyve, etc.) Each script would have to scan and when it finds an availab= le [up]link number hope its still there when it attempts the `connect`. "uplink" was introduced with review D23963. I have preserved the requirement you still can not have "uplink0". That will be automatically handled if you connect and request "uplink", it will give you "uplink1" or higher dependin= g on availability but never "uplink0". Because [up]link number is not required it also becomes possible to inspect a netgraph node type and based on that determine the `peerhook` argument to connect to an ng_bridge. I added a change to bhyve to do exactly that. This allows for a simplification when using netgraph with bhyve, which beca= me possible with review D24620. Instead of: -t netgraph,socket=3Dvm0,path=3Dvmbridge:,hook=3Dvm0link,peerhook=3Dlin= k0 You can shorten to just: -t netgraph,path=3Dvmbridge: Instead of: -t netgraph,socket=3Dvm1,path=3Digb0:,hook=3Dvm1link,peerhook=3Dlower You can shorten to just: -t netgraph,path=3Digb0: I'm just removing the need for `peerhook`. No need to specify `socket` or `hook` as the code exists today. Without this you could start just passing "link" = for peerhook when using an ng_bridge. It makes the bhyve change optional, and I= 'm ok if its removed, I mostly care about not having to deal with numbering li= nks for my jails that use ng_eiface. This change is not 100% backward compatible though. The unr(9) is shared by `link` and `uplink`. The current code will allow `link1` and `uplink1` and = this change will not. The total number of [up]links is unchanged. But bear in mi= nd uplink is for a physical interface connected to an ng_bridge, and the expectation is that you have only one of these, so it would be wasteful to = have a separate unr(9) for just "uplink". But other than that it does still allow users to specify [up]link number. The tarball contains patches for CURRENT and stable/14. stable/13 still uses the the array of 32 hooks with NG_BRIDGE_MAX_LINKS. It also contains some simple tests to try with ngctl(8). --=20 You are receiving this mail because: You are the assignee for the bug.=