diff --git a/.gitignore b/.gitignore index 091285c..bb69c11 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,8 @@ defs.h.in defs.h.in~ /lib/stamp-h1 test-suite.log -libnl-3.5.0 - +libnl-3.7.0 +!solve-oh-compile-problem.patch /libnl-1.pc /lib/defs.h cscope.* diff --git a/BUILD.gn b/BUILD.gn index 9642ed8..8c42c81 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -21,7 +21,7 @@ action("build_grammar") { "--header-file=$grammer_hh", "-o", rebase_path("$target_out_dir/gen/lib/route/pktloc_grammar.c"), - rebase_path("libnl-3.5.0/lib/route/pktloc_grammar.l"), + rebase_path("libnl-3.7.0/lib/route/pktloc_grammar.l"), ] } @@ -34,7 +34,7 @@ action("pktloc_syntax") { "-d", "-o", rebase_path("$target_out_dir/gen/lib/route/pktloc_syntax.c"), - rebase_path("libnl-3.5.0/lib/route/pktloc_syntax.y"), + rebase_path("libnl-3.7.0/lib/route/pktloc_syntax.y"), ] } @@ -47,7 +47,7 @@ action("ematch_grammar") { "--header-file=$grammer_hh", "-o", rebase_path("$target_out_dir/gen/lib/route/cls/ematch_grammar.c"), - rebase_path("libnl-3.5.0/lib/route/cls/ematch_grammar.l"), + rebase_path("libnl-3.7.0/lib/route/cls/ematch_grammar.l"), ] } @@ -60,7 +60,7 @@ action("ematch_syntax") { "-d", "-o", rebase_path("$target_out_dir/gen/lib/route/cls/ematch_syntax.c"), - rebase_path("libnl-3.5.0/lib/route/cls/ematch_syntax.y"), + rebase_path("libnl-3.7.0/lib/route/cls/ematch_syntax.y"), ] } if (!defined(ohos_lite)) { @@ -75,11 +75,11 @@ if (!defined(ohos_lite)) { syntax_path = get_path_info(syntax_outputs[0], "dir") include_dirs = [ - "libnl-3.5.0", - "libnl-3.5.0/include", - "libnl-3.5.0/lib", - "libnl-3.5.0/lib/route/cls", - "libnl-3.5.0/lib/route", + "libnl-3.7.0", + "libnl-3.7.0/include", + "libnl-3.7.0/lib", + "libnl-3.7.0/lib/route/cls", + "libnl-3.7.0/lib/route", ] include_dirs += [ @@ -90,155 +90,161 @@ if (!defined(ohos_lite)) { ] sources = [ - "libnl-3.5.0/lib/addr.c", - "libnl-3.5.0/lib/attr.c", - "libnl-3.5.0/lib/cache.c", - "libnl-3.5.0/lib/cache_mngr.c", - "libnl-3.5.0/lib/cache_mngt.c", - "libnl-3.5.0/lib/data.c", - "libnl-3.5.0/lib/error.c", - "libnl-3.5.0/lib/handlers.c", - "libnl-3.5.0/lib/hash.c", - "libnl-3.5.0/lib/hashtable.c", - "libnl-3.5.0/lib/mpls.c", - "libnl-3.5.0/lib/msg.c", - "libnl-3.5.0/lib/nl.c", - "libnl-3.5.0/lib/object.c", - "libnl-3.5.0/lib/socket.c", - "libnl-3.5.0/lib/utils.c", - "libnl-3.5.0/lib/version.c", - "libnl-3.5.0/lib/fib_lookup/lookup.c", - "libnl-3.5.0/lib/fib_lookup/request.c", - "libnl-3.5.0/lib/genl/ctrl.c", - "libnl-3.5.0/lib/genl/family.c", - "libnl-3.5.0/lib/genl/genl.c", - "libnl-3.5.0/lib/genl/mngt.c", - "libnl-3.5.0/lib/idiag/idiag.c", - "libnl-3.5.0/lib/idiag/idiag_meminfo_obj.c", - "libnl-3.5.0/lib/idiag/idiag_msg_obj.c", - "libnl-3.5.0/lib/idiag/idiag_req_obj.c", - "libnl-3.5.0/lib/idiag/idiag_vegasinfo_obj.c", - "libnl-3.5.0/lib/netfilter/ct.c", - "libnl-3.5.0/lib/netfilter/ct_obj.c", - "libnl-3.5.0/lib/netfilter/exp.c", - "libnl-3.5.0/lib/netfilter/exp_obj.c", - "libnl-3.5.0/lib/netfilter/log.c", - "libnl-3.5.0/lib/netfilter/log_msg.c", - "libnl-3.5.0/lib/netfilter/log_msg_obj.c", - "libnl-3.5.0/lib/netfilter/log_obj.c", - "libnl-3.5.0/lib/netfilter/netfilter.c", - "libnl-3.5.0/lib/netfilter/nfnl.c", - "libnl-3.5.0/lib/netfilter/queue.c", - "libnl-3.5.0/lib/netfilter/queue_msg.c", - "libnl-3.5.0/lib/netfilter/queue_msg_obj.c", - "libnl-3.5.0/lib/netfilter/queue_obj.c", - "libnl-3.5.0/lib/route/act.c", - "libnl-3.5.0/lib/route/addr.c", - "libnl-3.5.0/lib/route/class.c", - "libnl-3.5.0/lib/route/classid.c", - "libnl-3.5.0/lib/route/cls.c", - "libnl-3.5.0/lib/route/link.c", - "libnl-3.5.0/lib/route/neigh.c", - "libnl-3.5.0/lib/route/neightbl.c", - "libnl-3.5.0/lib/route/netconf.c", - "libnl-3.5.0/lib/route/nexthop.c", - "libnl-3.5.0/lib/route/nexthop_encap.c", - "libnl-3.5.0/lib/route/nh_encap_mpls.c", - "libnl-3.5.0/lib/route/pktloc.c", + "libnl-3.7.0/lib/addr.c", + "libnl-3.7.0/lib/attr.c", + "libnl-3.7.0/lib/cache.c", + "libnl-3.7.0/lib/cache_mngr.c", + "libnl-3.7.0/lib/cache_mngt.c", + "libnl-3.7.0/lib/data.c", + "libnl-3.7.0/lib/error.c", + "libnl-3.7.0/lib/handlers.c", + "libnl-3.7.0/lib/hash.c", + "libnl-3.7.0/lib/hashtable.c", + "libnl-3.7.0/lib/mpls.c", + "libnl-3.7.0/lib/msg.c", + "libnl-3.7.0/lib/nl.c", + "libnl-3.7.0/lib/object.c", + "libnl-3.7.0/lib/socket.c", + "libnl-3.7.0/lib/utils.c", + "libnl-3.7.0/lib/version.c", + "libnl-3.7.0/lib/fib_lookup/lookup.c", + "libnl-3.7.0/lib/fib_lookup/request.c", + "libnl-3.7.0/lib/genl/ctrl.c", + "libnl-3.7.0/lib/genl/family.c", + "libnl-3.7.0/lib/genl/genl.c", + "libnl-3.7.0/lib/genl/mngt.c", + "libnl-3.7.0/lib/idiag/idiag.c", + "libnl-3.7.0/lib/idiag/idiag_meminfo_obj.c", + "libnl-3.7.0/lib/idiag/idiag_msg_obj.c", + "libnl-3.7.0/lib/idiag/idiag_req_obj.c", + "libnl-3.7.0/lib/idiag/idiag_vegasinfo_obj.c", + "libnl-3.7.0/lib/netfilter/ct.c", + "libnl-3.7.0/lib/netfilter/ct_obj.c", + "libnl-3.7.0/lib/netfilter/exp.c", + "libnl-3.7.0/lib/netfilter/exp_obj.c", + "libnl-3.7.0/lib/netfilter/log.c", + "libnl-3.7.0/lib/netfilter/log_msg.c", + "libnl-3.7.0/lib/netfilter/log_msg_obj.c", + "libnl-3.7.0/lib/netfilter/log_obj.c", + "libnl-3.7.0/lib/netfilter/netfilter.c", + "libnl-3.7.0/lib/netfilter/nfnl.c", + "libnl-3.7.0/lib/netfilter/queue.c", + "libnl-3.7.0/lib/netfilter/queue_msg.c", + "libnl-3.7.0/lib/netfilter/queue_msg_obj.c", + "libnl-3.7.0/lib/netfilter/queue_obj.c", + "libnl-3.7.0/lib/route/act.c", + "libnl-3.7.0/lib/route/addr.c", + "libnl-3.7.0/lib/route/class.c", + "libnl-3.7.0/lib/route/classid.c", + "libnl-3.7.0/lib/route/cls.c", + "libnl-3.7.0/lib/route/link.c", + "libnl-3.7.0/lib/route/mdb.c", + "libnl-3.7.0/lib/route/neigh.c", + "libnl-3.7.0/lib/route/neightbl.c", + "libnl-3.7.0/lib/route/netconf.c", + "libnl-3.7.0/lib/route/nexthop.c", + "libnl-3.7.0/lib/route/nexthop_encap.c", + "libnl-3.7.0/lib/route/nh_encap_mpls.c", + "libnl-3.7.0/lib/route/pktloc.c", rebase_path("$grammer_path/pktloc_grammar.c"), rebase_path("$pktloc_path/pktloc_syntax.c"), - "libnl-3.5.0/lib/route/qdisc.c", - "libnl-3.5.0/lib/route/route.c", - "libnl-3.5.0/lib/route/route_obj.c", - "libnl-3.5.0/lib/route/route_utils.c", - "libnl-3.5.0/lib/route/rtnl.c", - "libnl-3.5.0/lib/route/rule.c", - "libnl-3.5.0/lib/route/tc.c", - "libnl-3.5.0/lib/route/act/gact.c", - "libnl-3.5.0/lib/route/act/mirred.c", - "libnl-3.5.0/lib/route/act/skbedit.c", - "libnl-3.5.0/lib/route/act/vlan.c", - "libnl-3.5.0/lib/route/cls/basic.c", - "libnl-3.5.0/lib/route/cls/cgroup.c", - "libnl-3.5.0/lib/route/cls/ematch.c", + "libnl-3.7.0/lib/route/qdisc.c", + "libnl-3.7.0/lib/route/route.c", + "libnl-3.7.0/lib/route/route_obj.c", + "libnl-3.7.0/lib/route/route_utils.c", + "libnl-3.7.0/lib/route/rtnl.c", + "libnl-3.7.0/lib/route/rule.c", + "libnl-3.7.0/lib/route/tc.c", + "libnl-3.7.0/lib/route/act/gact.c", + "libnl-3.7.0/lib/route/act/mirred.c", + "libnl-3.7.0/lib/route/act/nat.c", + "libnl-3.7.0/lib/route/act/skbedit.c", + "libnl-3.7.0/lib/route/act/vlan.c", + "libnl-3.7.0/lib/route/cls/basic.c", + "libnl-3.7.0/lib/route/cls/cgroup.c", + "libnl-3.7.0/lib/route/cls/ematch.c", rebase_path("$ematch_path/ematch_grammar.c"), rebase_path("$syntax_path/ematch_syntax.c"), - "libnl-3.5.0/lib/route/cls/fw.c", - "libnl-3.5.0/lib/route/cls/mall.c", - "libnl-3.5.0/lib/route/cls/police.c", - "libnl-3.5.0/lib/route/cls/u32.c", - "libnl-3.5.0/lib/route/cls/ematch/cmp.c", - "libnl-3.5.0/lib/route/cls/ematch/container.c", - "libnl-3.5.0/lib/route/cls/ematch/meta.c", - "libnl-3.5.0/lib/route/cls/ematch/nbyte.c", - "libnl-3.5.0/lib/route/cls/ematch/text.c", - "libnl-3.5.0/lib/route/link/api.c", - "libnl-3.5.0/lib/route/link/bonding.c", - "libnl-3.5.0/lib/route/link/bridge.c", - "libnl-3.5.0/lib/route/link/can.c", - "libnl-3.5.0/lib/route/link/dummy.c", - "libnl-3.5.0/lib/route/link/geneve.c", - "libnl-3.5.0/lib/route/link/ifb.c", - "libnl-3.5.0/lib/route/link/inet6.c", - "libnl-3.5.0/lib/route/link/inet.c", - "libnl-3.5.0/lib/route/link/ip6tnl.c", - "libnl-3.5.0/lib/route/link/ipgre.c", - "libnl-3.5.0/lib/route/link/ipip.c", - "libnl-3.5.0/lib/route/link/ipvlan.c", - "libnl-3.5.0/lib/route/link/ipvti.c", - "libnl-3.5.0/lib/route/link/macsec.c", - "libnl-3.5.0/lib/route/link/macvlan.c", - "libnl-3.5.0/lib/route/link/ppp.c", - "libnl-3.5.0/lib/route/link/sit.c", - "libnl-3.5.0/lib/route/link/sriov.c", - "libnl-3.5.0/lib/route/link/veth.c", - "libnl-3.5.0/lib/route/link/vlan.c", - "libnl-3.5.0/lib/route/link/vrf.c", - "libnl-3.5.0/lib/route/link/vxlan.c", - "libnl-3.5.0/lib/route/link/xfrmi.c", - "libnl-3.5.0/lib/route/qdisc/blackhole.c", - "libnl-3.5.0/lib/route/qdisc/cbq.c", - "libnl-3.5.0/lib/route/qdisc/dsmark.c", - "libnl-3.5.0/lib/route/qdisc/fifo.c", - "libnl-3.5.0/lib/route/qdisc/fq_codel.c", - "libnl-3.5.0/lib/route/qdisc/hfsc.c", - "libnl-3.5.0/lib/route/qdisc/htb.c", - "libnl-3.5.0/lib/route/qdisc/ingress.c", - "libnl-3.5.0/lib/route/qdisc/mqprio.c", - "libnl-3.5.0/lib/route/qdisc/netem.c", - "libnl-3.5.0/lib/route/qdisc/plug.c", - "libnl-3.5.0/lib/route/qdisc/prio.c", - "libnl-3.5.0/lib/route/qdisc/red.c", - "libnl-3.5.0/lib/route/qdisc/sfq.c", - "libnl-3.5.0/lib/route/qdisc/tbf.c", - "libnl-3.5.0/lib/xfrm/ae.c", - "libnl-3.5.0/lib/xfrm/lifetime.c", - "libnl-3.5.0/lib/xfrm/sa.c", - "libnl-3.5.0/lib/xfrm/selector.c", - "libnl-3.5.0/lib/xfrm/sp.c", - "libnl-3.5.0/lib/xfrm/template.c", - "libnl-3.5.0/lib/cli/cls/basic.c", - "libnl-3.5.0/lib/cli/cls/cgroup.c", - "libnl-3.5.0/lib/cli/qdisc/bfifo.c", - "libnl-3.5.0/lib/cli/qdisc/blackhole.c", - "libnl-3.5.0/lib/cli/qdisc/fq_codel.c", - "libnl-3.5.0/lib/cli/qdisc/hfsc.c", - "libnl-3.5.0/lib/cli/qdisc/htb.c", - "libnl-3.5.0/lib/cli/qdisc/ingress.c", - "libnl-3.5.0/lib/cli/qdisc/pfifo.c", - "libnl-3.5.0/lib/cli/qdisc/plug.c", - "libnl-3.5.0/src/lib/addr.c", - "libnl-3.5.0/src/lib/class.c", - "libnl-3.5.0/src/lib/cls.c", - "libnl-3.5.0/src/lib/ct.c", - "libnl-3.5.0/src/lib/exp.c", - "libnl-3.5.0/src/lib/link.c", - "libnl-3.5.0/src/lib/neigh.c", - "libnl-3.5.0/src/lib/qdisc.c", - "libnl-3.5.0/src/lib/route.c", - "libnl-3.5.0/src/lib/rule.c", - "libnl-3.5.0/src/lib/tc.c", - "libnl-3.5.0/src/lib/utils.c", + "libnl-3.7.0/lib/route/cls/flower.c", + "libnl-3.7.0/lib/route/cls/fw.c", + "libnl-3.7.0/lib/route/cls/mall.c", + "libnl-3.7.0/lib/route/cls/police.c", + "libnl-3.7.0/lib/route/cls/u32.c", + "libnl-3.7.0/lib/route/cls/ematch/cmp.c", + "libnl-3.7.0/lib/route/cls/ematch/container.c", + "libnl-3.7.0/lib/route/cls/ematch/meta.c", + "libnl-3.7.0/lib/route/cls/ematch/nbyte.c", + "libnl-3.7.0/lib/route/cls/ematch/text.c", + "libnl-3.7.0/lib/route/link/api.c", + "libnl-3.7.0/lib/route/link/bonding.c", + "libnl-3.7.0/lib/route/link/bridge.c", + "libnl-3.7.0/lib/route/link/can.c", + "libnl-3.7.0/lib/route/link/dummy.c", + "libnl-3.7.0/lib/route/link/geneve.c", + "libnl-3.7.0/lib/route/link/ifb.c", + "libnl-3.7.0/lib/route/link/inet6.c", + "libnl-3.7.0/lib/route/link/inet.c", + "libnl-3.7.0/lib/route/link/ip6pre.c", + "libnl-3.7.0/lib/route/link/ip6tnl.c", + "libnl-3.7.0/lib/route/link/ip6vti.c", + "libnl-3.7.0/lib/route/link/ipgre.c", + "libnl-3.7.0/lib/route/link/ipip.c", + "libnl-3.7.0/lib/route/link/ipvlan.c", + "libnl-3.7.0/lib/route/link/ipvti.c", + "libnl-3.7.0/lib/route/link/macsec.c", + "libnl-3.7.0/lib/route/link/macvlan.c", + "libnl-3.7.0/lib/route/link/ppp.c", + "libnl-3.7.0/lib/route/link/sit.c", + "libnl-3.7.0/lib/route/link/sriov.c", + "libnl-3.7.0/lib/route/link/team.c", + "libnl-3.7.0/lib/route/link/veth.c", + "libnl-3.7.0/lib/route/link/vlan.c", + "libnl-3.7.0/lib/route/link/vrf.c", + "libnl-3.7.0/lib/route/link/vxlan.c", + "libnl-3.7.0/lib/route/link/xfrmi.c", + "libnl-3.7.0/lib/route/qdisc/blackhole.c", + "libnl-3.7.0/lib/route/qdisc/cbq.c", + "libnl-3.7.0/lib/route/qdisc/dsmark.c", + "libnl-3.7.0/lib/route/qdisc/fifo.c", + "libnl-3.7.0/lib/route/qdisc/fq_codel.c", + "libnl-3.7.0/lib/route/qdisc/hfsc.c", + "libnl-3.7.0/lib/route/qdisc/htb.c", + "libnl-3.7.0/lib/route/qdisc/ingress.c", + "libnl-3.7.0/lib/route/qdisc/mqprio.c", + "libnl-3.7.0/lib/route/qdisc/netem.c", + "libnl-3.7.0/lib/route/qdisc/plug.c", + "libnl-3.7.0/lib/route/qdisc/prio.c", + "libnl-3.7.0/lib/route/qdisc/red.c", + "libnl-3.7.0/lib/route/qdisc/sfq.c", + "libnl-3.7.0/lib/route/qdisc/tbf.c", + "libnl-3.7.0/lib/xfrm/ae.c", + "libnl-3.7.0/lib/xfrm/lifetime.c", + "libnl-3.7.0/lib/xfrm/sa.c", + "libnl-3.7.0/lib/xfrm/selector.c", + "libnl-3.7.0/lib/xfrm/sp.c", + "libnl-3.7.0/lib/xfrm/template.c", + "libnl-3.7.0/lib/cli/cls/basic.c", + "libnl-3.7.0/lib/cli/cls/cgroup.c", + "libnl-3.7.0/lib/cli/qdisc/bfifo.c", + "libnl-3.7.0/lib/cli/qdisc/blackhole.c", + "libnl-3.7.0/lib/cli/qdisc/fq_codel.c", + "libnl-3.7.0/lib/cli/qdisc/hfsc.c", + "libnl-3.7.0/lib/cli/qdisc/htb.c", + "libnl-3.7.0/lib/cli/qdisc/ingress.c", + "libnl-3.7.0/lib/cli/qdisc/pfifo.c", + "libnl-3.7.0/lib/cli/qdisc/plug.c", + "libnl-3.7.0/src/lib/addr.c", + "libnl-3.7.0/src/lib/class.c", + "libnl-3.7.0/src/lib/cls.c", + "libnl-3.7.0/src/lib/ct.c", + "libnl-3.7.0/src/lib/exp.c", + "libnl-3.7.0/src/lib/link.c", + "libnl-3.7.0/src/lib/neigh.c", + "libnl-3.7.0/src/lib/qdisc.c", + "libnl-3.7.0/src/lib/route.c", + "libnl-3.7.0/src/lib/rule.c", + "libnl-3.7.0/src/lib/tc.c", + "libnl-3.7.0/src/lib/utils.c", ] deps = [ diff --git a/README.OpenSource b/README.OpenSource index 03e7deb..214f53d 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -3,9 +3,9 @@ "Name": "openEuler:libnl3", "License": "LGPL V2.1", "License File": "COPYING", - "Version Number": "3.5.0-4.oe2203", + "Version Number": "3.7.0-1.oe2203sp1", "Owner": "xusai4@huawei.com", - "Upstream URL": "https://repo.openeuler.org/openEuler-22.03-LTS/source/Packages/libnl3-3.5.0-4.oe2203.src.rpm", + "Upstream URL": "https://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/Packages/libnl3-3.7.0-1.oe2203sp1.src.rpm", "Description": "Providing APIs to netlink protocol based Linux kernel interfaces." } ] \ No newline at end of file diff --git a/backport-lib-add-include-netlink-private-nl-auto-h-header.patch b/backport-lib-add-include-netlink-private-nl-auto-h-header.patch deleted file mode 100644 index 43f95c6..0000000 --- a/backport-lib-add-include-netlink-private-nl-auto-h-header.patch +++ /dev/null @@ -1,123 +0,0 @@ -From abb7391f38893af7d6108f97ac8597468f113a41 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 15 Apr 2020 12:42:05 +0200 -Subject: [PATCH] lib: add "include/netlink-private/nl-auto.h" header - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/abb7391f38893af7d6108f97ac8597468f113a41 - ---- - Makefile.am | 1 + - include/netlink-private/nl-auto.h | 60 +++++++++++++++++++++++++++++++ - include/netlink-private/utils.h | 14 ++------ - 3 files changed, 63 insertions(+), 12 deletions(-) - create mode 100644 include/netlink-private/nl-auto.h - -diff --git a/Makefile.am b/Makefile.am -index b2e87379..085da53f 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -261,6 +261,7 @@ noinst_HEADERS = \ - include/netlink-private/cache-api.h \ - include/netlink-private/genl.h \ - include/netlink-private/netlink.h \ -+ include/netlink-private/nl-auto.h \ - include/netlink-private/object-api.h \ - include/netlink-private/route/link/api.h \ - include/netlink-private/route/link/sriov.h \ -diff --git a/include/netlink-private/nl-auto.h b/include/netlink-private/nl-auto.h -new file mode 100644 -index 00000000..7b923f26 ---- /dev/null -+++ b/include/netlink-private/nl-auto.h -@@ -0,0 +1,60 @@ -+// SPDX-License-Identifier: LGPL-2.1+ -+ -+#ifndef NETLINK_NL_AUTO_H_ -+#define NETLINK_NL_AUTO_H_ -+ -+#define _nl_auto(fcn) __attribute__ ((__cleanup__(fcn))) -+ -+#define _NL_AUTO_DEFINE_FCN_VOID0(CastType, name, func) \ -+static inline void name(void *v) \ -+{ \ -+ if (*((CastType *) v)) \ -+ func(*((CastType *) v)); \ -+} -+ -+#define _NL_AUTO_DEFINE_FCN_TYPED0(CastType, name, func) \ -+static inline void name(CastType *v) \ -+{ \ -+ if (*v) \ -+ func(*v); \ -+} -+ -+#define _nl_auto_free _nl_auto(_nl_auto_free_fcn) -+_NL_AUTO_DEFINE_FCN_VOID0(void *, _nl_auto_free_fcn, free) -+ -+struct nl_addr; -+void nl_addr_put(struct nl_addr *); -+#define _nl_auto_nl_addr _nl_auto(_nl_auto_nl_addr_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_addr *, _nl_auto_nl_addr_fcn, nl_addr_put) -+ -+struct nl_msg; -+void nlmsg_free(struct nl_msg *); -+#define _nl_auto_nl_msg _nl_auto(_nl_auto_nl_msg_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_msg *, _nl_auto_nl_msg_fcn, nlmsg_free) -+ -+struct rtnl_link; -+void rtnl_link_put(struct rtnl_link *); -+#define _nl_auto_rtnl_link _nl_auto(_nl_auto_rtnl_link_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_link *, _nl_auto_rtnl_link_fcn, rtnl_link_put) -+ -+struct rtnl_route; -+void rtnl_route_put(struct rtnl_route *); -+#define _nl_auto_rtnl_route _nl_auto(_nl_auto_rtnl_route_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_route *, _nl_auto_rtnl_route_fcn, rtnl_route_put) -+ -+struct rtnl_nexthop; -+void rtnl_route_nh_free(struct rtnl_nexthop *); -+#define _nl_auto_rtnl_nexthop _nl_auto(_nl_auto_rtnl_nexthop_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_nexthop *, _nl_auto_rtnl_nexthop_fcn, rtnl_route_nh_free) -+ -+struct nl_cache; -+void nl_cache_put(struct nl_cache *); -+#define _nl_auto_nl_cache _nl_auto(_nl_auto_nl_cache_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_cache *, _nl_auto_nl_cache_fcn, nl_cache_put) -+ -+struct rtnl_link_af_ops; -+void rtnl_link_af_ops_put(struct rtnl_link_af_ops *); -+#define _nl_auto_rtnl_link_af_ops _nl_auto(_nl_auto_rtnl_link_af_ops_fcn) -+_NL_AUTO_DEFINE_FCN_TYPED0(struct rtnl_link_af_ops *, _nl_auto_rtnl_link_af_ops_fcn, rtnl_link_af_ops_put) -+ -+#endif /* NETLINK_NL_AUTO_H_ */ -diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h -index 9c5a3d82..46e77451 100644 ---- a/include/netlink-private/utils.h -+++ b/include/netlink-private/utils.h -@@ -85,18 +85,6 @@ - - /*****************************************************************************/ - --#define _NL_AUTO_DEFINE_FCN_VOID0(CastType, name, func) \ --static inline void name (void *v) \ --{ \ -- if (*((CastType *) v)) \ -- func (*((CastType *) v)); \ --} -- --#define _nl_auto_free _nl_auto(_nl_auto_free_fcn) --_NL_AUTO_DEFINE_FCN_VOID0 (void *, _nl_auto_free_fcn, free) -- --/*****************************************************************************/ -- - extern const char *nl_strerror_l(int err); - - /*****************************************************************************/ -@@ -222,4 +210,6 @@ _nl_strncpy(char *dst, const char *src, size_t len) - return dst; - } - -+#include "nl-auto.h" -+ - #endif diff --git a/backport-lib-use-proper-int-type-for-id-attributes-in-nl_object_identical.patch b/backport-lib-use-proper-int-type-for-id-attributes-in-nl_object_identical.patch deleted file mode 100644 index bb6e7ff..0000000 --- a/backport-lib-use-proper-int-type-for-id-attributes-in-nl_object_identical.patch +++ /dev/null @@ -1,29 +0,0 @@ -From f9d0181ceb2fc7c54abf89eff4c6b57e8fe6dd97 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Fri, 17 Apr 2020 16:31:10 +0200 -Subject: [PATCH] lib: use proper int type for id attributes in - nl_object_identical() - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/f9d0181ceb2fc7c54abf89eff4c6b57e8fe6dd97 - ---- - lib/object.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/lib/object.c b/lib/object.c -index d15cd152..07a21d22 100644 ---- a/lib/object.c -+++ b/lib/object.c -@@ -314,8 +314,9 @@ int nl_object_identical(struct nl_object *a, struct nl_object *b) - return 0; - - if (ops->oo_id_attrs_get) { -- int req_attrs_a = ops->oo_id_attrs_get(a); -- int req_attrs_b = ops->oo_id_attrs_get(b); -+ uint32_t req_attrs_a = ops->oo_id_attrs_get(a); -+ uint32_t req_attrs_b = ops->oo_id_attrs_get(b); -+ - if (req_attrs_a != req_attrs_b) - return 0; - req_attrs = req_attrs_a; diff --git a/backport-route-link-Check-for-null-pointer-in-macvlan.patch b/backport-route-link-Check-for-null-pointer-in-macvlan.patch deleted file mode 100644 index f98be4b..0000000 --- a/backport-route-link-Check-for-null-pointer-in-macvlan.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 01ea9a6224b77292e8506bf179729aeeaac30398 Mon Sep 17 00:00:00 2001 -From: Jan Slomski -Date: Wed, 21 Mar 2018 10:23:57 +0100 -Subject: [PATCH] route/link: Check for null pointer in macvlan - -In cases where link->l_info is not set, a null-ptr-exception -will be invoked. - -https://github.com/thom311/libnl/pull/238 - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/01ea9a6224b77292e8506bf179729aeeaac30398 -Reference:https://github.com/thom311/libnl/commit/9cc38dcaeb55b5729c6c97b47884cebbda72b693 ---- - lib/route/link/macvlan.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/route/link/macvlan.c b/lib/route/link/macvlan.c -index a23fe6d8..3ccebf45 100644 ---- a/lib/route/link/macvlan.c -+++ b/lib/route/link/macvlan.c -@@ -149,6 +149,8 @@ static void macvlan_free(struct rtnl_link *link) - uint32_t i; - - mvi = link->l_info; -+ if (!mvi) -+ return; - - for (i = 0; i < mvi->mvi_maccount; i++) - nl_addr_put(mvi->mvi_macaddr[i]); diff --git a/backport-route-link-add-RTNL_LINK_REASM_OVERLAPS-stat.patch b/backport-route-link-add-RTNL_LINK_REASM_OVERLAPS-stat.patch deleted file mode 100644 index 488a12b..0000000 --- a/backport-route-link-add-RTNL_LINK_REASM_OVERLAPS-stat.patch +++ /dev/null @@ -1,66 +0,0 @@ -From bab9e77c87d3b596e77d669b0a827b50e725bb62 Mon Sep 17 00:00:00 2001 -From: Ilya Pronin -Date: Fri, 3 Apr 2020 20:00:37 -0700 -Subject: [PATCH] route/link: add RTNL_LINK_REASM_OVERLAPS stat - -The new stat exposes IPSTATS_MIB_REASM_OVERLAPS link stat. However, the -original motivation for this change was fixing the issue with missing RX -packets link stat. - -The regression was introduced in version 3.5.0 with commit 73c1d047, -that added a new enum constant IPSTATS_MIB_REASM_OVERLAPS. Without this -patch, IPSTATS_MIB_REASM_OVERLAPS is missing from -map_stat_id_from_IPSTATS_MIB_v2 and is mapped by it to 0. This tricks -inet6_parse_protinfo() into erroneously overwriting RTNL_LINK_RX_PACKETS -stat, which happens to have value 0, when it tries to set -IPSTATS_MIB_REASM_OVERLAPS. - -Fixes: 73c1d0479643 ('Sync linux headers to 4.19.66') - -https://github.com/thom311/libnl/pull/235 - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/bab9e77c87d3b596e77d669b0a827b50e725bb62 - ---- - include/netlink/route/link.h | 1 + - lib/route/link.c | 1 + - lib/route/link/inet6.c | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h -index 516d8e16..d0d6d2b5 100644 ---- a/include/netlink/route/link.h -+++ b/include/netlink/route/link.h -@@ -93,6 +93,7 @@ typedef enum { - RTNL_LINK_IP6_ECT0PKTS, /*!< IPv6 SNMP InECT0Pkts */ - RTNL_LINK_IP6_CEPKTS, /*!< IPv6 SNMP InCEPkts */ - RTNL_LINK_RX_NOHANDLER, /*!< Received packets dropped on inactive device */ -+ RTNL_LINK_REASM_OVERLAPS, /*!< SNMP ReasmOverlaps */ - __RTNL_LINK_STATS_MAX, - } rtnl_link_stat_id_t; - -diff --git a/lib/route/link.c b/lib/route/link.c -index 9439fe6d..ed6f4558 100644 ---- a/lib/route/link.c -+++ b/lib/route/link.c -@@ -3007,6 +3007,7 @@ static const struct trans_tbl link_stats[] = { - __ADD(RTNL_LINK_IP6_ECT0PKTS, Ip6_InECT0Pkts), - __ADD(RTNL_LINK_IP6_CEPKTS, Ip6_InCEPkts), - __ADD(RTNL_LINK_RX_NOHANDLER, rx_nohandler), -+ __ADD(RTNL_LINK_REASM_OVERLAPS, ReasmOverlaps), - }; - - char *rtnl_link_stat2str(int st, char *buf, size_t len) -diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c -index c977b617..1ad49bf1 100644 ---- a/lib/route/link/inet6.c -+++ b/lib/route/link/inet6.c -@@ -135,6 +135,7 @@ static const uint8_t map_stat_id_from_IPSTATS_MIB_v2[__IPSTATS_MIB_MAX] = { - [33] = RTNL_LINK_IP6_ECT1PKTS, /* IPSTATS_MIB_ECT1PKTS */ - [34] = RTNL_LINK_IP6_ECT0PKTS, /* IPSTATS_MIB_ECT0PKTS */ - [35] = RTNL_LINK_IP6_CEPKTS, /* IPSTATS_MIB_CEPKTS */ -+ [36] = RTNL_LINK_REASM_OVERLAPS, /* IPSTATS_MIB_REASM_OVERLAPS */ - }; - - static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr, diff --git a/backport-rtnl-link-fix-leaking-rtnl_link_af_ops-in-link_msg_parser.patch b/backport-rtnl-link-fix-leaking-rtnl_link_af_ops-in-link_msg_parser.patch deleted file mode 100644 index cc8cbb9..0000000 --- a/backport-rtnl-link-fix-leaking-rtnl_link_af_ops-in-link_msg_parser.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2957d8f6c8bf1189545a7b0c1a49c4ccb26984a1 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 15 Apr 2020 14:01:09 +0200 -Subject: [PATCH] rtnl/link: fix leaking rtnl_link_af_ops in link_msg_parser() - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/2957d8f6c8bf1189545a7b0c1a49c4ccb26984a1 - ---- - lib/route/link.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/route/link.c b/lib/route/link.c -index 0ce4b0ab..b73a8c5f 100644 ---- a/lib/route/link.c -+++ b/lib/route/link.c -@@ -722,6 +722,8 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, - int remaining; - - nla_for_each_nested(af_attr, tb[IFLA_AF_SPEC], remaining) { -+ _nl_auto_rtnl_link_af_ops struct rtnl_link_af_ops *af_ops = NULL; -+ - af_ops = af_lookup_and_alloc(link, nla_type(af_attr)); - if (af_ops && af_ops->ao_parse_af) { - char *af_data = link->l_af_data[nla_type(af_attr)]; diff --git a/backport-rtnl-route-fix-NLE_NOMEM-handling-in-parse_multipath.patch b/backport-rtnl-route-fix-NLE_NOMEM-handling-in-parse_multipath.patch deleted file mode 100644 index 77d5c61..0000000 --- a/backport-rtnl-route-fix-NLE_NOMEM-handling-in-parse_multipath.patch +++ /dev/null @@ -1,40 +0,0 @@ -From fca338b9f453295037f96e8fe9236ebb4763dd25 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 15 Apr 2020 13:17:40 +0200 -Subject: [PATCH] rtnl/route: fix NLE_NOMEM handling in parse_multipath() - -Conflict:NA -Reference:https://github.com/thom311/libnl/commit/fca338b9f453295037f96e8fe9236ebb4763dd25 - ---- - lib/route/route_obj.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c -index b5cc4ed4..de56a76b 100644 ---- a/lib/route/route_obj.c -+++ b/lib/route/route_obj.c -@@ -1072,8 +1072,10 @@ static int parse_multipath(struct rtnl_route *route, struct nlattr *attr) - - addr = nl_addr_alloc_attr(ntb[RTA_NEWDST], - route->rt_family); -- if (!addr) -+ if (!addr) { -+ err = -NLE_NOMEM; - goto errout; -+ } - - err = rtnl_route_nh_set_newdst(nh, addr); - nl_addr_put(addr); -@@ -1085,8 +1087,10 @@ static int parse_multipath(struct rtnl_route *route, struct nlattr *attr) - struct nl_addr *addr; - - addr = rtnl_route_parse_via(ntb[RTA_VIA]); -- if (!addr) -+ if (!addr) { -+ err = -NLE_NOMEM; - goto errout; -+ } - - err = rtnl_route_nh_set_via(nh, addr); - nl_addr_put(addr); diff --git a/bundle.json b/bundle.json index a98b5a1..39cd172 100644 --- a/bundle.json +++ b/bundle.json @@ -1,7 +1,7 @@ { "name": "@ohos/libnl", "description": "Providing APIs to netlink protocol based Linux kernel interfaces.", - "version": "4.0", + "version": "1.0", "license": "LGPL V2.1", "publishAs": "code-segment", "segment": { @@ -9,7 +9,7 @@ }, "dirs": {}, "scripts": {}, - "licensePath": "thirdparth/libnl-3.5.0/COPYING", + "licensePath": "thirdparth/libnl-3.7.0/COPYING", "readmePath":{ "en": "README.md", "zh": "README_ZH.md" diff --git a/install.sh b/install.sh index fcc1ef9..cc3fe19 100755 --- a/install.sh +++ b/install.sh @@ -8,18 +8,12 @@ set -e cd $1 -if [ -d "libnl-3.5.0" ];then - rm -rf libnl-3.5.0 +if [ -d "libnl-3.7.0" ];then + rm -rf libnl-3.7.0 fi -tar xvf libnl-3.5.0.tar.gz -cd $1/libnl-3.5.0 +tar xvf libnl-3.7.0.tar.gz +cd $1/libnl-3.7.0 ./configure -patch -p1 < $1/backport-lib-add-include-netlink-private-nl-auto-h-header.patch --fuzz=0 --no-backup-if-mismatch -patch -p1 < $1/backport-lib-use-proper-int-type-for-id-attributes-in-nl_object_identical.patch --fuzz=0 --no-backup-if-mismatch -patch -p1 < $1/backport-route-link-add-RTNL_LINK_REASM_OVERLAPS-stat.patch --fuzz=0 --no-backup-if-mismatch -patch -p1 < $1/backport-route-link-Check-for-null-pointer-in-macvlan.patch --fuzz=0 --no-backup-if-mismatch -patch -p1 < $1/backport-rtnl-link-fix-leaking-rtnl_link_af_ops-in-link_msg_parser.patch --fuzz=0 --no-backup-if-mismatch -patch -p1 < $1/backport-rtnl-route-fix-NLE_NOMEM-handling-in-parse_multipath.patch --fuzz=0 --no-backup-if-mismatch patch -p1 < $1/solve-redefinition-of-struct-ipv6_mreq.patch --fuzz=0 --no-backup-if-mismatch patch -p1 < $1/solve-oh-compile-problem.patch --fuzz=0 --no-backup-if-mismatch exit 0 diff --git a/libnl-3.5.0.tar.gz b/libnl-3.5.0.tar.gz deleted file mode 100644 index 049b1ca..0000000 Binary files a/libnl-3.5.0.tar.gz and /dev/null differ diff --git a/libnl-3.7.0.tar.gz b/libnl-3.7.0.tar.gz new file mode 100644 index 0000000..f7ab177 Binary files /dev/null and b/libnl-3.7.0.tar.gz differ diff --git a/libnl3.spec b/libnl3.spec index 8b32e85..9061b31 100644 --- a/libnl3.spec +++ b/libnl3.spec @@ -1,18 +1,10 @@ Name: libnl3 -Version: 3.5.0 -Release: 4 +Version: 3.7.0 +Release: 1 Summary: Providing APIs to netlink protocol based Linux kernel interfaces License: LGPLv2 URL: http://www.infradead.org/~tgr/libnl/ -Source: https://github.com/thom311/libnl/releases/download/libnl3_5_0/libnl-3.5.0.tar.gz - -Patch6000: backport-lib-add-include-netlink-private-nl-auto-h-header.patch -Patch6001: backport-lib-use-proper-int-type-for-id-attributes-in-nl_object_identical.patch -Patch6002: backport-route-link-add-RTNL_LINK_REASM_OVERLAPS-stat.patch -Patch6003: backport-route-link-Check-for-null-pointer-in-macvlan.patch -Patch6004: backport-rtnl-link-fix-leaking-rtnl_link_af_ops-in-link_msg_parser.patch -Patch6005: backport-rtnl-route-fix-NLE_NOMEM-handling-in-parse_multipath.patch -Patch9000: solve-redefinition-of-struct-ipv6_mreq.patch +Source: https://github.com/thom311/libnl/releases/download/libnl3_7_0/libnl-3.7.0.tar.gz BuildRequires: flex bison libtool autoconf automake swig Requires: %{name} = %{version}-%{release} @@ -97,6 +89,12 @@ cd python %{python3_sitearch}/netlink-*.egg-info %changelog +* Mon Nov 7 2022 chengyechun - 3.7.0-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update to libnl-3.7.0 + * Wed Mar 10 2021 zengwefeng - 3.5.0-4 - Type:bugfix - ID:NA diff --git a/solve-oh-compile-problem.patch b/solve-oh-compile-problem.patch index 89e7643..d2b71af 100644 --- a/solve-oh-compile-problem.patch +++ b/solve-oh-compile-problem.patch @@ -1,46 +1,78 @@ -diff --git a/lib/route/link/vrf.c b/lib/route/link/vrf.c -index 8b6b451..31d62f8 100644 ---- a/lib/route/link/vrf.c -+++ b/lib/route/link/vrf.c -@@ -33,7 +33,6 @@ - #include - - #include --#include - - #define VRF_TABLE_ID_MAX RT_TABLE_MAX - -diff --git a/lib/utils.c b/lib/utils.c -index 496bf3b..a1dc815 100644 ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -226,8 +226,8 @@ double nl_cancel_down_bits(unsigned long long l, char **unit) - +diff -urN libnl-3.7.0/include/netlink-private/utils.h libnl-3.7.0-new/include/netlink-private/utils.h +--- libnl-3.7.0/include/netlink-private/utils.h 2022-05-24 16:55:12.000000000 +0800 ++++ libnl-3.7.0-new/include/netlink-private/utils.h 2024-01-13 18:22:20.218754000 +0800 +@@ -114,10 +114,8 @@ + + #define _nl_assert_addr_family(addr_family) \ + do { \ +- typeof(addr_family) _addr_family = (addr_family); \ +- \ +- _nl_assert(_addr_family == AF_INET || \ +- _addr_family == AF_INET6); \ ++ _nl_assert(addr_family == AF_INET || \ ++ addr_family == AF_INET6); \ + } while (0) + + /*****************************************************************************/ +diff -urN libnl-3.7.0/lib/route/mdb.c libnl-3.7.0-new/lib/route/mdb.c +--- libnl-3.7.0/lib/route/mdb.c 2022-05-24 16:55:12.000000000 +0800 ++++ libnl-3.7.0-new/lib/route/mdb.c 2024-01-13 18:23:23.811971400 +0800 +@@ -7,7 +7,7 @@ + #include + #include + #include +-#include ++#include + + /** @cond SKIP */ + #define MDB_ATTR_IFINDEX 0x000001 +diff -urN libnl-3.7.0/lib/utils.c libnl-3.7.0-new/lib/utils.c +--- libnl-3.7.0/lib/utils.c 2022-07-06 23:21:11.000000000 +0800 ++++ libnl-3.7.0-new/lib/utils.c 2024-01-13 18:24:36.832909100 +0800 +@@ -157,7 +157,7 @@ + * Cancels down a byte counter until it reaches a reasonable + * unit. The chosen unit is assigned to \a unit. + * This function assume 1024 bytes in one kilobyte +- * ++ * + * @return The cancelled down byte counter in the new unit. + */ + double nl_cancel_down_bytes(unsigned long long l, char **unit) +@@ -219,8 +219,8 @@ + int nl_rate2str(unsigned long long rate, int type, char *buf, size_t len) { - char *unit; - double frac; + char *unit = NULL; + double frac = 0.0; - + switch (type) { case NL_BYTE_RATE: -@@ -374,6 +374,7 @@ char *nl_size2str(const size_t size, char *buf, const size_t len) +@@ -367,6 +367,7 @@ } - + BUG(); + return buf; } - + /** -diff --git a/src/lib/utils.c b/src/lib/utils.c -index 3aa2a90..99e9fe5 100644 ---- a/src/lib/utils.c -+++ b/src/lib/utils.c -@@ -31,6 +31,8 @@ +@@ -426,7 +427,7 @@ + * + * Supports the environment variables: + * PROC_NET_PSCHED - may point to psched file in /proc +- * PROC_ROOT - may point to /proc fs */ ++ * PROC_ROOT - may point to /proc fs */ + static void get_psched_settings(void) + { + char name[FILENAME_MAX]; +diff -urN libnl-3.7.0/src/lib/utils.c libnl-3.7.0-new/src/lib/utils.c +--- libnl-3.7.0/src/lib/utils.c 2022-05-24 16:55:12.000000000 +0800 ++++ libnl-3.7.0-new/src/lib/utils.c 2024-01-13 18:26:00.112970500 +0800 +@@ -24,6 +24,8 @@ #include #endif - + +#define PKGLIBDIR "/usr/local/lib" + /**