<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in netlink.c</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>92a871ab - libbpf: Use OPTS_SET() macro in bpf_xdp_query()</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#92a871ab</link>
        <description>libbpf: Use OPTS_SET() macro in bpf_xdp_query()When the feature_flags and xdp_zc_max_segs fields were added to the libbpfbpf_xdp_query_opts, the code writing them did not use the OPTS_SET() macro.This causes libbpf to write to those fields unconditionally, which meansthat programs compiled against an older version of libbpf (with a smallersize of the bpf_xdp_query_opts struct) will have its stack corrupted bylibbpf writing out of bounds.The patch adding the feature_flags field has an early bail out if thefeature_flags field is not part of the opts struct (via the OPTS_HAS)macro, but the patch adding xdp_zc_max_segs does not. For consistency, thisfix just changes the assignments to both fields to use the OPTS_SET()macro.Fixes: 13ce2daa259a (&quot;xsk: add new netlink attribute dedicated for ZC max frags&quot;)Signed-off-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Link: https://lore.kernel.org/bpf/20240206125922.1992815-1-toke@redhat.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Tue, 06 Feb 2024 12:59:22 +0000</pubDate>
        <dc:creator>Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;</dc:creator>
    </item>
<item>
        <title>13ce2daa - xsk: add new netlink attribute dedicated for ZC max frags</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#13ce2daa</link>
        <description>xsk: add new netlink attribute dedicated for ZC max fragsIntroduce new netlink attribute NETDEV_A_DEV_XDP_ZC_MAX_SEGS that willcarry maximum fragments that underlying ZC driver is able to handle onTX side. It is going to be included in netlink response only when driversupports ZC. Any value higher than 1 implies multi-buffer ZC support onunderlying device.Signed-off-by: Maciej Fijalkowski &lt;maciej.fijalkowski@intel.com&gt;Link: https://lore.kernel.org/r/20230719132421.584801-11-maciej.fijalkowski@intel.comSigned-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 19 Jul 2023 13:24:07 +0000</pubDate>
        <dc:creator>Maciej Fijalkowski &lt;maciej.fijalkowski@intel.com&gt;</dc:creator>
    </item>
<item>
        <title>c8ee37bd - libbpf: Fix bpf_xdp_query() in old kernels</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#c8ee37bd</link>
        <description>libbpf: Fix bpf_xdp_query() in old kernelsCommit 04d58f1b26a4(&quot;libbpf: add API to get XDP/XSK supported features&quot;)added feature_flags to struct bpf_xdp_query_opts. If a user usesbpf_xdp_query_opts with feature_flags member, the bpf_xdp_query()will check whether &apos;netdev&apos; family exists or not in the kernel.If it does not exist, the bpf_xdp_query() will return -ENOENT.But &apos;netdev&apos; family does not exist in old kernels as it isintroduced in the same patch set as Commit 04d58f1b26a4.So old kernel with newer libbpf won&apos;t work properly withbpf_xdp_query() api call.To fix this issue, if the return value oflibbpf_netlink_resolve_genl_family_id() is -ENOENT, bpf_xdp_query()will just return 0, skipping the rest of xdp feature query.This preserves backward compatibility.Fixes: 04d58f1b26a4 (&quot;libbpf: add API to get XDP/XSK supported features&quot;)Signed-off-by: Yonghong Song &lt;yhs@fb.com&gt;Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Link: https://lore.kernel.org/bpf/20230227224943.1153459-1-yhs@fb.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Mon, 27 Feb 2023 22:49:43 +0000</pubDate>
        <dc:creator>Yonghong Song &lt;yhs@fb.com&gt;</dc:creator>
    </item>
<item>
        <title>629dfc66 - libbpf: Use bpf_{btf,link,map,prog}_get_info_by_fd()</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#629dfc66</link>
        <description>libbpf: Use bpf_{btf,link,map,prog}_get_info_by_fd()Use the new type-safe wrappers around bpf_obj_get_info_by_fd().Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Link: https://lore.kernel.org/bpf/20230214231221.249277-3-iii@linux.ibm.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Tue, 14 Feb 2023 23:12:15 +0000</pubDate>
        <dc:creator>Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;</dc:creator>
    </item>
<item>
        <title>02fc0e73 - libbpf: Always use libbpf_err to return an error in bpf_xdp_query()</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#02fc0e73</link>
        <description>libbpf: Always use libbpf_err to return an error in bpf_xdp_query()In order to properly set errno, rely on libbpf_err utility routine inbpf_xdp_query() to return an error to the caller.Fixes: 04d58f1b26a4 (&quot;libbpf: add API to get XDP/XSK supported features&quot;)Signed-off-by: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Link: https://lore.kernel.org/bpf/827d40181f9f90fb37702f44328e1614df7c0503.1675768112.git.lorenzo@kernel.org

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Tue, 07 Feb 2023 11:11:03 +0000</pubDate>
        <dc:creator>Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>04d58f1b - libbpf: add API to get XDP/XSK supported features</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#04d58f1b</link>
        <description>libbpf: add API to get XDP/XSK supported featuresExtend bpf_xdp_query routine in order to get XDP/XSK supported featuresof netdev over route netlink interface.Extend libbpf netlink implementation in order to support netlink_genericprotocol.Co-developed-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Co-developed-by: Marek Majtyka &lt;alardam@gmail.com&gt;Signed-off-by: Marek Majtyka &lt;alardam@gmail.com&gt;Signed-off-by: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;Link: https://lore.kernel.org/r/a72609ef4f0de7fee5376c40dbf54ad7f13bfb8d.1675245258.git.lorenzo@kernel.orgSigned-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 01 Feb 2023 10:24:21 +0000</pubDate>
        <dc:creator>Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>8f166931 - libbpf: add the capability to specify netlink proto in libbpf_netlink_send_recv</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#8f166931</link>
        <description>libbpf: add the capability to specify netlink proto in libbpf_netlink_send_recvThis is a preliminary patch in order to introduce netlink_genericprotocol support to libbpf.Signed-off-by: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;Link: https://lore.kernel.org/r/7878a54667e74afeec3ee519999c044bd514b44c.1675245258.git.lorenzo@kernel.orgSigned-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 01 Feb 2023 10:24:20 +0000</pubDate>
        <dc:creator>Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>813847a3 - libbpf: Streamline bpf_attr and perf_event_attr initialization</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#813847a3</link>
        <description>libbpf: Streamline bpf_attr and perf_event_attr initializationMake sure that entire libbpf code base is initializing bpf_attr andperf_event_attr with memset(0). Also for bpf_attr make sure weclear and pass to kernel only relevant parts of bpf_attr. bpf_attr isa huge union of independent sub-command attributes, so there is no needto clear and pass entire union bpf_attr, which over time grows quitea lot and for most commands this growth is completely irrelevant.Few cases where we were relying on compiler initialization of BPF UAPIstructs (like bpf_prog_info, bpf_map_info, etc) with `= {};` wereswitched to memset(0) pattern for future-proofing.Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Acked-by: Hao Luo &lt;haoluo@google.com&gt;Link: https://lore.kernel.org/bpf/20220816001929.369487-3-andrii@kernel.org

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Tue, 16 Aug 2022 00:19:27 +0000</pubDate>
        <dc:creator>Andrii Nakryiko &lt;andrii@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>53e6af3a - libbpf: remove deprecated XDP APIs</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#53e6af3a</link>
        <description>libbpf: remove deprecated XDP APIsGet rid of deprecated bpf_set_link*() and bpf_get_link*() APIs.Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Link: https://lore.kernel.org/r/20220627211527.2245459-4-andrii@kernel.orgSigned-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Mon, 27 Jun 2022 21:15:15 +0000</pubDate>
        <dc:creator>Andrii Nakryiko &lt;andrii@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>1b8c924a - libbpf: Fix memleak in libbpf_netlink_recv()</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#1b8c924a</link>
        <description>libbpf: Fix memleak in libbpf_netlink_recv()Ensure that libbpf_netlink_recv() frees dynamically allocated buffer inall code paths.Fixes: 9c3de619e13e (&quot;libbpf: Use dynamically allocated buffer when receiving netlink messages&quot;)Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Acked-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/bpf/20220217073958.276959-1-andrii@kernel.org

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Thu, 17 Feb 2022 07:39:58 +0000</pubDate>
        <dc:creator>Andrii Nakryiko &lt;andrii@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>9c3de619 - libbpf: Use dynamically allocated buffer when receiving netlink messages</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#9c3de619</link>
        <description>libbpf: Use dynamically allocated buffer when receiving netlink messagesWhen receiving netlink messages, libbpf was using a statically allocatedstack buffer of 4k bytes. This happened to work fine on systems with a 4kpage size, but on systems with larger page sizes it can lead to truncatedmessages. The user-visible impact of this was that libbpf would insist noXDP program was attached to some interfaces because that bit of the netlinkmessage got chopped off.Fix this by switching to a dynamically allocated buffer; we borrow theapproach from iproute2 of using recvmsg() with MSG_PEEK|MSG_TRUNC to getthe actual size of the pending message before receiving it, adjusting thebuffer as necessary. While we&apos;re at it, also add retries on interruptedsystem calls around the recvmsg() call.v2:  - Move peek logic to libbpf_netlink_recv(), don&apos;t double free on ENOMEM.Fixes: 8bbb77b7c7a2 (&quot;libbpf: Add various netlink helpers&quot;)Reported-by: Zhiqian Guan &lt;zhguan@redhat.com&gt;Signed-off-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Acked-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Link: https://lore.kernel.org/bpf/20220211234819.612288-1-toke@redhat.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Fri, 11 Feb 2022 23:48:19 +0000</pubDate>
        <dc:creator>Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;</dc:creator>
    </item>
<item>
        <title>c359821a - libbpf: streamline low-level XDP APIs</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#c359821a</link>
        <description>libbpf: streamline low-level XDP APIsIntroduce 4 new netlink-based XDP APIs for attaching, detaching, andquerying XDP programs:  - bpf_xdp_attach;  - bpf_xdp_detach;  - bpf_xdp_query;  - bpf_xdp_query_id.These APIs replace bpf_set_link_xdp_fd, bpf_set_link_xdp_fd_opts,bpf_get_link_xdp_id, and bpf_get_link_xdp_info APIs ([0]). The latterdon&apos;t follow a consistent naming pattern and some of them usenon-extensible approaches (e.g., struct xdp_link_info which can&apos;t bemodified without breaking libbpf ABI).The approach I took with these low-level XDP APIs is similar to what wedid with low-level TC APIs. There is a nice duality of bpf_tc_attach vsbpf_xdp_attach, and so on. I left bpf_xdp_attach() to support detachingwhen -1 is specified for prog_fd for generality and convenience, butbpf_xdp_detach() is preferred due to clearer naming and associatedsemantics. Both bpf_xdp_attach() and bpf_xdp_detach() accept the sameopts struct allowing to specify expected old_prog_fd.While doing the refactoring, I noticed that old APIs require users tospecify opts with old_fd == -1 to declare &quot;don&apos;t care about alreadyattached XDP prog fd&quot; condition. Otherwise, FD 0 is assumed, which isessentially never an intended behavior. So I made this behaviorconsistent with other kernel and libbpf APIs, in which zero FD means &quot;noFD&quot;. This seems to be more in line with the latest thinking in BPF landand should cause less user confusion, hopefully.For querying, I left two APIs, both more generic bpf_xdp_query()allowing to query multiple IDs and attach mode, but alsoa specialization of it, bpf_xdp_query_id(), which returns only requestedprog_id. Uses of prog_id returning bpf_get_link_xdp_id() were soprevalent across selftests and samples, that it seemed a very common usecase and using bpf_xdp_query() for doing it felt very cumbersome witha highly branches if/else chain based on flags and attach mode.Old APIs are scheduled for deprecation in libbpf 0.8 release.  [0] Closes: https://github.com/libbpf/libbpf/issues/309Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Acked-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/r/20220120061422.2710637-2-andrii@kernel.orgSigned-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Thu, 20 Jan 2022 06:14:19 +0000</pubDate>
        <dc:creator>Andrii Nakryiko &lt;andrii@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>ee62a5c6 - libbpf: Switch to void * casting in netlink helpers</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#ee62a5c6</link>
        <description>libbpf: Switch to void * casting in netlink helpersNetlink helpers I added in 8bbb77b7c7a2 (&quot;libbpf: Add various netlinkhelpers&quot;) used char * casts everywhere, and there were a few more thatexisted from before.Convert all of them to void * cast, as it is treated equivalently byclang/gcc for the purposes of pointer arithmetic and to follow theconvention elsewhere in the kernel/libbpf.Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Link: https://lore.kernel.org/bpf/20210619041454.417577-2-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Sat, 19 Jun 2021 04:14:54 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>0ae64fb6 - libbpf: Add request buffer type for netlink messages</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#0ae64fb6</link>
        <description>libbpf: Add request buffer type for netlink messagesCoverity complains about OOB writes to nlmsghdr. There is no OOB as wewrite to the trailing buffer, but static analyzers and compilers mayrightfully be confused as the nlmsghdr pointer has subobject provenance(and hence subobject bounds).Fix this by using an explicit request structure containing the nlmsghdr,struct tcmsg/ifinfomsg, and attribute buffer.Also switch nh_tail (renamed to req_tail) to cast req * to char * sothat it can be understood as arithmetic on pointer to the representationarray (hence having same bound as request structure), which shouldfurther appease analyzers.As a bonus, callers don&apos;t have to pass sizeof(req) all the time now, assize is implicitly obtained using the pointer. While at it, also reducethe size of attribute buffer to 128 bytes (132 for ifinfomsg usingfunctions due to the padding).Summary of problem:  Even though C standard allows interconvertibility of pointer to first  member and pointer to struct, for the purposes of alias analysis it  would still consider the first as having pointer value &quot;pointer to T&quot;  where T is type of first member hence having subobject bounds,  allowing analyzers within reason to complain when object is accessed  beyond the size of pointed to object.  The only exception to this rule may be when a char * is formed to a  member subobject. It is not possible for the compiler to be able to  tell the intent of the programmer that it is a pointer to member  object or the underlying representation array of the containing  object, so such diagnosis is suppressed.Fixes: 715c5ce454a6 (&quot;libbpf: Add low level TC-BPF management API&quot;)Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Link: https://lore.kernel.org/bpf/20210619041454.417577-1-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Sat, 19 Jun 2021 04:14:53 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>bbf29d3a - libbpf: Set NLM_F_EXCL when creating qdisc</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#bbf29d3a</link>
        <description>libbpf: Set NLM_F_EXCL when creating qdiscThis got lost during the refactoring across versions. We always useNLM_F_EXCL when creating some TC object, so reflect what the functionsays and set the flag.Fixes: 715c5ce454a6 (&quot;libbpf: Add low level TC-BPF management API&quot;)Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Link: https://lore.kernel.org/bpf/20210612023502.1283837-3-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Sat, 12 Jun 2021 02:35:01 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>4e164f87 - libbpf: Remove unneeded check for flags during tc detach</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#4e164f87</link>
        <description>libbpf: Remove unneeded check for flags during tc detachCoverity complained about this being unreachable code. It is rightbecause we already enforce flags to be unset, so a check validatingthe flag value is redundant.Fixes: 715c5ce454a6 (&quot;libbpf: Add low level TC-BPF management API&quot;)Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Link: https://lore.kernel.org/bpf/20210612023502.1283837-2-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Sat, 12 Jun 2021 02:35:00 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>e9fc3ce9 - libbpf: Streamline error reporting for high-level APIs</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#e9fc3ce9</link>
        <description>libbpf: Streamline error reporting for high-level APIsImplement changes to error reporting for high-level libbpf APIs to make themless surprising and less error-prone to users:  - in all the cases when error happens, errno is set to an appropriate error    value;  - in libbpf 1.0 mode, all pointer-returning APIs return NULL on error and    error code is communicated through errno; this applies both to APIs that    already returned NULL before (so now they communicate more detailed error    codes), as well as for many APIs that used ERR_PTR() macro and encoded    error numbers as fake pointers.  - in legacy (default) mode, those APIs that were returning ERR_PTR(err),    continue doing so, but still set errno.With these changes, errno can be always used to extract actual error,regardless of legacy or libbpf 1.0 modes. This is utilized internally inlibbpf in places where libbpf uses it&apos;s own high-level APIs.libbpf_get_error() is adapted to handle both cases completely transparently toend-users (and is used by libbpf consistently as well).More context, justification, and discussion can be found in &quot;Libbpf: the roadto v1.0&quot; document ([0]).  [0] https://docs.google.com/document/d/1UyjTZuPFWiPFyKk1tV5an11_iaRuec6U-ZESZ54nNTYSigned-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;Acked-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/bpf/20210525035935.1461796-5-andrii@kernel.org

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Tue, 25 May 2021 03:59:34 +0000</pubDate>
        <dc:creator>Andrii Nakryiko &lt;andrii@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>715c5ce4 - libbpf: Add low level TC-BPF management API</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#715c5ce4</link>
        <description>libbpf: Add low level TC-BPF management APIThis adds functions that wrap the netlink API used for adding, manipulating,and removing traffic control filters.The API summary:A bpf_tc_hook represents a location where a TC-BPF filter can be attached.This means that creating a hook leads to creation of the backing qdisc,while destruction either removes all filters attached to a hook, or destroysqdisc if requested explicitly (as discussed below).The TC-BPF API functions operate on this bpf_tc_hook to attach, replace,query, and detach tc filters. All functions return 0 on success, and anegative error code on failure.bpf_tc_hook_create - Create a hookParameters:	@hook - Cannot be NULL, ifindex &gt; 0, attach_point must be set to		proper enum constant. Note that parent must be unset when		attach_point is one of BPF_TC_INGRESS or BPF_TC_EGRESS. Note		that as an exception BPF_TC_INGRESS|BPF_TC_EGRESS is also a		valid value for attach_point.		Returns -EOPNOTSUPP when hook has attach_point as BPF_TC_CUSTOM.bpf_tc_hook_destroy - Destroy a hookParameters:	@hook - Cannot be NULL. The behaviour depends on value of		attach_point. If BPF_TC_INGRESS, all filters attached to		the ingress hook will be detached. If BPF_TC_EGRESS, all		filters attached to the egress hook will be detached. If		BPF_TC_INGRESS|BPF_TC_EGRESS, the clsact qdisc will be		deleted, also detaching all filters. As before, parent must		be unset for these attach_points, and set for BPF_TC_CUSTOM.		It is advised that if the qdisc is operated on by many programs,		then the program at least check that there are no other existing		filters before deleting the clsact qdisc. An example is shown		below:		DECLARE_LIBBPF_OPTS(bpf_tc_hook, .ifindex = if_nametoindex(&quot;lo&quot;),				    .attach_point = BPF_TC_INGRESS);		/* set opts as NULL, as we&apos;re not really interested in		 * getting any info for a particular filter, but just	 	 * detecting its presence.		 */		r = bpf_tc_query(&amp;hook, NULL);		if (r == -ENOENT) {			/* no filters */			hook.attach_point = BPF_TC_INGRESS|BPF_TC_EGREESS;			return bpf_tc_hook_destroy(&amp;hook);		} else {			/* failed or r == 0, the latter means filters do exist */			return r;		}		Note that there is a small race between checking for no		filters and deleting the qdisc. This is currently unavoidable.		Returns -EOPNOTSUPP when hook has attach_point as BPF_TC_CUSTOM.bpf_tc_attach - Attach a filter to a hookParameters:	@hook - Cannot be NULL. Represents the hook the filter will be		attached to. Requirements for ifindex and attach_point are		same as described in bpf_tc_hook_create, but BPF_TC_CUSTOM		is also supported.  In that case, parent must be set to the		handle where the filter will be attached (using BPF_TC_PARENT).		E.g. to set parent to 1:16 like in tc command line, the		equivalent would be BPF_TC_PARENT(1, 16).	@opts - Cannot be NULL. The following opts are optional:		* handle   - The handle of the filter		* priority - The priority of the filter			     Must be &gt;= 0 and &lt;= UINT16_MAX		Note that when left unset, they will be auto-allocated by		the kernel. The following opts must be set:		* prog_fd - The fd of the loaded SCHED_CLS prog		The following opts must be unset:		* prog_id - The ID of the BPF prog		The following opts are optional:		* flags - Currently only BPF_TC_F_REPLACE is allowed. It			  allows replacing an existing filter instead of			  failing with -EEXIST.		The following opts will be filled by bpf_tc_attach on a		successful attach operation if they are unset:		* handle   - The handle of the attached filter		* priority - The priority of the attached filter		* prog_id  - The ID of the attached SCHED_CLS prog		This way, the user can know what the auto allocated values		for optional opts like handle and priority are for the newly		attached filter, if they were unset.		Note that some other attributes are set to fixed default		values listed below (this holds for all bpf_tc_* APIs):		protocol as ETH_P_ALL, direct action mode, chain index of 0,		and class ID of 0 (this can be set by writing to the		skb-&gt;tc_classid field from the BPF program).bpf_tc_detachParameters:	@hook - Cannot be NULL. Represents the hook the filter will be		detached from. Requirements are same as described above		in bpf_tc_attach.	@opts - Cannot be NULL. The following opts must be set:		* handle, priority		The following opts must be unset:		* prog_fd, prog_id, flagsbpf_tc_queryParameters:	@hook - Cannot be NULL. Represents the hook where the filter lookup will		be performed. Requirements are same as described above in		bpf_tc_attach().	@opts - Cannot be NULL. The following opts must be set:		* handle, priority		The following opts must be unset:		* prog_fd, prog_id, flags		The following fields will be filled by bpf_tc_query upon a		successful lookup:		* prog_idSome usage examples (using BPF skeleton infrastructure):BPF program (test_tc_bpf.c):	#include &lt;linux/bpf.h&gt;	#include &lt;bpf/bpf_helpers.h&gt;	SEC(&quot;classifier&quot;)	int cls(struct __sk_buff *skb)	{		return 0;	}Userspace loader:	struct test_tc_bpf *skel = NULL;	int fd, r;	skel = test_tc_bpf__open_and_load();	if (!skel)		return -ENOMEM;	fd = bpf_program__fd(skel-&gt;progs.cls);	DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex =			    if_nametoindex(&quot;lo&quot;), .attach_point =			    BPF_TC_INGRESS);	/* Create clsact qdisc */	r = bpf_tc_hook_create(&amp;hook);	if (r &lt; 0)		goto end;	DECLARE_LIBBPF_OPTS(bpf_tc_opts, opts, .prog_fd = fd);	r = bpf_tc_attach(&amp;hook, &amp;opts);	if (r &lt; 0)		goto end;	/* Print the auto allocated handle and priority */	printf(&quot;Handle=%u&quot;, opts.handle);	printf(&quot;Priority=%u&quot;, opts.priority);	opts.prog_fd = opts.prog_id = 0;	bpf_tc_detach(&amp;hook, &amp;opts);end:	test_tc_bpf__destroy(skel);This is equivalent to doing the following using tc command line:  # tc qdisc add dev lo clsact  # tc filter add dev lo ingress bpf obj foo.o sec classifier da  # tc filter del dev lo ingress handle &lt;h&gt; prio &lt;p&gt; bpf... where the handle and priority can be found using:  # tc filter show dev lo ingressAnother example replacing a filter (extending prior example):	/* We can also choose both (or one), let&apos;s try replacing an	 * existing filter.	 */	DECLARE_LIBBPF_OPTS(bpf_tc_opts, replace_opts, .handle =			    opts.handle, .priority = opts.priority,			    .prog_fd = fd);	r = bpf_tc_attach(&amp;hook, &amp;replace_opts);	if (r == -EEXIST) {		/* Expected, now use BPF_TC_F_REPLACE to replace it */		replace_opts.flags = BPF_TC_F_REPLACE;		return bpf_tc_attach(&amp;hook, &amp;replace_opts);	} else if (r &lt; 0) {		return r;	}	/* There must be no existing filter with these	 * attributes, so cleanup and return an error.	 */	replace_opts.prog_fd = replace_opts.prog_id = 0;	bpf_tc_detach(&amp;hook, &amp;replace_opts);	return -1;To obtain info of a particular filter:	/* Find info for filter with handle 1 and priority 50 */	DECLARE_LIBBPF_OPTS(bpf_tc_opts, info_opts, .handle = 1,			    .priority = 50);	r = bpf_tc_query(&amp;hook, &amp;info_opts);	if (r == -ENOENT)		printf(&quot;Filter not found&quot;);	else if (r &lt; 0)		return r;	printf(&quot;Prog ID: %u&quot;, info_opts.prog_id);	return 0;Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Co-developed-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt; # libbpf API design[ Daniel: also did major patch cleanup ]Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Reviewed-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/bpf/20210512103451.989420-3-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 12 May 2021 23:41:22 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>8bbb77b7 - libbpf: Add various netlink helpers</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#8bbb77b7</link>
        <description>libbpf: Add various netlink helpersThis change introduces a few helpers to wrap open coded attributepreparation in netlink.c. It also adds a libbpf_netlink_send_recv() thatis useful to wrap send + recv handling in a generic way. Subsequent patchwill also use this function for sending and receiving a netlink response.The libbpf_nl_get_link() helper has been removed instead, moving socketcreation into the newly named libbpf_netlink_send_recv().Every nested attribute&apos;s closure must happen using the helpernlattr_end_nested(), which sets its length properly. NLA_F_NESTED isenforced using nlattr_begin_nested() helper. Other simple attributescan be added directly.The maxsz parameter corresponds to the size of the request structurewhich is being filled in, so for instance with req being:  struct {	struct nlmsghdr nh;	struct tcmsg t;	char buf[4096];  } req;Then, maxsz should be sizeof(req).This change also converts the open coded attribute preparation with thesehelpers. Note that the only failure the internal call to nlattr_add()could result in the nested helper would be -EMSGSIZE, hence that is whatwe return to our caller.The libbpf_netlink_send_recv() call takes care of opening the socket,sending the netlink message, receiving the response, potentially invokingcallbacks, and return errors if any, and then finally close the socket.This allows users to avoid identical socket setup code in different places.The only user of libbpf_nl_get_link() has been converted to make use of it.__bpf_set_link_xdp_fd_replace() has also been refactored to use it.Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;[ Daniel: major patch cleanup ]Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Reviewed-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/bpf/20210512103451.989420-2-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 12 May 2021 10:34:49 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>58bfd95b - libbpf: Use SOCK_CLOEXEC when opening the netlink socket</title>
        <link>http://172.16.0.5:8080/history/linux-6.15/tools/lib/bpf/netlink.c#58bfd95b</link>
        <description>libbpf: Use SOCK_CLOEXEC when opening the netlink socketOtherwise, there exists a small window between the opening and closingof the socket fd where it may leak into processes launched by some otherthread.Fixes: 949abbe88436 (&quot;libbpf: add function to setup XDP&quot;)Signed-off-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;Acked-by: Toke H&#248;iland-J&#248;rgensen &lt;toke@redhat.com&gt;Link: https://lore.kernel.org/bpf/20210317115857.6536-1-memxor@gmail.com

            List of files:
            /linux-6.15/tools/lib/bpf/netlink.c</description>
        <pubDate>Wed, 17 Mar 2021 11:58:58 +0000</pubDate>
        <dc:creator>Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;</dc:creator>
    </item>
</channel>
</rss>
