{"id":446448,"date":"2025-01-29T09:01:32","date_gmt":"2025-01-29T09:01:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=446448"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-01-29T09:01:32","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=446448","title":{"rendered":"<span>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 libnl \u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u043e\u043c \u0432 Linux<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0442\u0438\u043b\u0438\u0442\u044b traffic control\u00a0 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libnl \u043d\u0430 \u0441\/c++. \u0423 libnl \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f <a href=\"https:\/\/www.infradead.org\/~tgr\/libnl\/doc\/route.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u0442\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/github.com\/thom311\/libnl\/tree\/main\/tests\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u0441\u0442\u043e\u0432<\/a>. \u041a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439.<\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/tc.8.html\" rel=\"noopener noreferrer nofollow\">Traffic control<\/a> \u2014 \u0443\u0442\u0438\u043b\u0438\u0442\u0430  \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u043e\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e tc \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 QoS (Quality of Service), \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c SHAPING\u00a0(\u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435), SCHEDULING (\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0438\u0437\u0430\u0446\u0438\u044f), POLICING (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435) \u0438 DROPPING (\u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u0435) \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">tc qdisc add dev lo root handle 1: htb default 20  tc class add dev lo parent 1: classid 1:1 htb rate 10240kbit  tc class add dev lo parent 1:1 classid 1:10 htb rate 100kbit ceil 10240kbit prio 1  tc class add dev lo parent 1:1 classid 1:20 htb rate 100kbit ceil 10240kbit prio 2 tc filter add dev lo parent 1: protocol ip prio 1 u32  match ip dst 127.0.0.1\/32  flowid 1:10<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430 htb (\u0448\u0435\u0439\u043f\u0435\u0440) \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 loopback (default 20 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e  \u0432\u0435\u0441\u044c \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u0435\u0441\u0451\u043d \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u0441 \u043c\u0435\u0442\u043a\u043e\u0439 20). \u0414\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0448\u0435\u0439\u043f\u0435\u0440\u0430.\u00a0 \u0424\u0438\u043b\u044c\u0442\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e ip \u0430\u0434\u0440\u0435\u0441\u0441 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 127.0.0.1\/32 \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443. \u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0438\u0436\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/vitawasalreadytaken\/tcviz\" rel=\"noopener noreferrer nofollow\">tcviz<\/a>. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/hd\/56\/su\/hd56su8p6qmave48is4v5gwkh68.png\" width=\"746\" height=\"409\" data-src=\"https:\/\/habrastorage.org\/webt\/hd\/56\/su\/hd56su8p6qmave48is4v5gwkh68.png\"\/><\/figure>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libnl, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443(htb)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441(htb), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430, \u043e\u0434\u0438\u043d \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_qdisc_htb<\/code><\/p>\n<pre><code class=\"cpp\">void add_qdisc_htb(struct rtnl_link *link, uint32_t parent_handle, uint32_t handle, struct nl_sock* sock, uint32_t default_class) {     int err;     struct rtnl_qdisc *qdisc;     qdisc = rtnl_qdisc_alloc(); \/\/ \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u043e\u0434 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443     rtnl_tc_set_link(TC_CAST(qdisc), link);      rtnl_tc_set_parent(TC_CAST(qdisc), parent_handle); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441     rtnl_tc_set_handle(TC_CAST(qdisc), handle); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441     err = rtnl_tc_set_kind(TC_CAST(qdisc), \"htb\"); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b     throw_err(err);      err = rtnl_htb_set_defcls(qdisc, default_class); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     throw_err(err);      err = rtnl_qdisc_add(sock, qdisc, NLM_F_CREATE); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443     throw_err(err);     rtnl_qdisc_put(qdisc); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b }<\/code><\/pre>\n<p>\u0433\u0434\u0435<code>rtnl_link *link<\/code> \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443, <code>uint32_t parent_handle<\/code> &#8212; \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, <code>uint32_t handle<\/code> &#8212; \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 (\u0432\u0441\u0435 \u043c\u0435\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u044b tc \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435), <code>struct nl_sock* sock<\/code> &#8212; \u0441\u043e\u043a\u0435\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0434\u0440\u0430 linux, <code>uint32_t default_class<\/code> &#8212; \u043a\u043b\u0430\u0441\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c  \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_htb_class<\/code><\/p>\n<pre><code class=\"cpp\">void add_htb_class(struct rtnl_link *link, uint32_t parent_handle, uint32_t handle, struct nl_sock* sock,                    uint32_t rate, uint32_t ceil = 0, uint32_t prio = 0, uint32_t quantum = 0) {     int err;      struct rtnl_class *cl;      cl = rtnl_class_alloc();     rtnl_tc_set_link(TC_CAST(cl), link);     rtnl_tc_set_parent(TC_CAST(cl), parent_handle);     rtnl_tc_set_handle(TC_CAST(cl), handle);       err = rtnl_tc_set_kind(TC_CAST(cl), \"htb\");     throw_err(err);     err = rtnl_htb_set_rate(cl, rate);     throw_err(err);      if (ceil) {         err = rtnl_htb_set_ceil(cl, ceil);         throw_err(err);     }     if (prio) {         err = rtnl_htb_set_prio(cl, prio);         throw_err(err);     }     if (quantum) {         err = rtnl_htb_set_quantum(cl, quantum);         throw_err(err);     }      err = rtnl_class_add(sock, cl, NLM_F_CREATE);     throw_err(err);     rtnl_class_put(cl); } <\/code><\/pre>\n<p>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u043e\u0441\u0443 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, quantum \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/linkmeup.gitbook.io\/sdsm\/15.-qos\/6.-upravlenie-peregruzkami-congestion-management\/3-rr-round-robin\" rel=\"noopener noreferrer nofollow\">DWRR<\/a><\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_u32_filter_32key<\/code><\/p>\n<pre><code class=\"cpp\">void add_u32_filter_32key(struct rtnl_link *link, uint32_t handle, uint32_t flowid, struct nl_sock* sock, int prio, u32key key) {     struct rtnl_cls *filter;     int err;     filter = rtnl_cls_alloc();     rtnl_tc_set_link(TC_CAST(filter), link);     rtnl_tc_set_parent(TC_CAST(filter), handle);     err = rtnl_tc_set_kind(TC_CAST(filter), \"u32\");      throw_err(err);     rtnl_cls_set_prio(filter, prio);     rtnl_cls_set_protocol(filter, ETH_P_IP);     err = rtnl_u32_add_key_uint32(filter, key.value, key.mask, key.offset, key.keyoffmask); \/\/ \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430     throw_err(err);     err = rtnl_u32_set_classid(filter, flowid); \/\/ \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430     throw_err(err);     err = rtnl_u32_set_cls_terminal(filter);     throw_err(err);     err = rtnl_cls_add(sock, filter, NLM_F_CREATE);     throw_err(err);     rtnl_cls_put(filter); }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 u32key \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 4 \u043f\u043e\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b tc: <code>tc filtertc filter add dev lo parent 1: protocol ip prio 1 u32\u00a0 match ip dst 127.0.0.1\/32\u00a0 flowid 1:10<\/code>  \u043f\u043e\u043b\u0435 value \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ip \u0430\u0434\u0440\u0435\u0441\u0430, \u043f\u043e\u043b\u0435 mask \u0437\u0430 \u043c\u0430\u0441\u043a\u0443 \u0434\u043b\u044f ip \u0430\u0434\u0440\u0435\u0441\u0430, offset \u0437\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 ip \u043f\u0430\u043a\u0435\u0442\u0430 (\u0442.\u043a. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b ip), \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 keyoffmask \u044d\u0442\u043e \u043c\u0430\u0441\u043a\u0430 \u0434\u043b\u044f offset.<\/p>\n<pre><code class=\"cpp\">struct u32key {     uint32_t value;     uint32_t mask;     int offset;     int keyoffmask; };<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main<\/code> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<pre><code class=\"cpp\">int main() {      struct nl_cache *cache;     struct rtnl_link *link;     struct nl_sock *sock;     int if_index;     sock = nl_socket_alloc();     nl_connect(sock, NETLINK_ROUTE);     rtnl_link_alloc_cache(sock, AF_UNSPEC, &amp;cache);     link = rtnl_link_get_by_name(cache, \"lo\");       struct rtnl_qdisc *qdisc;     if (!(qdisc = rtnl_qdisc_alloc())) {         std::runtime_error(\"Can not allocate Qdisc\");     }     rtnl_tc_set_link(TC_CAST(qdisc), link);     rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);      \/\/Delete current qdisc     rtnl_qdisc_delete(sock, qdisc);     free(qdisc);        \/\/tc qdisc add dev eth1 root handle 1: htb default 20     add_qdisc_htb(link, TC_H_ROOT, TC_HANDLE(0x1, 0), sock, TC_HANDLE(0, 0x20));       \/\/tc class add dev eth1 parent 1: classid 1:1 htb rate 10240kbit     add_htb_class(link, TC_HANDLE(0x1, 0), TC_HANDLE(0x1, 0x1), sock, 1250000);      \/\/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 7168kbit     add_htb_class(link, TC_HANDLE(0x1, 0x1), TC_HANDLE(0x1, 0x10), sock, 12500, 1250000, 1);      \/\/tc class add dev eth1 parent 1:1 classid 1:20 htb rate 3072kbit ceil 10240kbit     add_htb_class(link, TC_HANDLE(0x1, 0x1), TC_HANDLE(0x1, 0x20), sock, 12500, 1250000, 2);      u32key key;     inet_pton(AF_INET, \"127.0.0.1\", &amp;(key.value));     inet_pton(AF_INET, \"255.255.255.255\", &amp;(key.mask));     key.value = ntohl(key.value);     key.mask = ntohl(key.mask);     key.offset = 16; \/\/ OFFSET_DESTINATION     int prio = 1;      \/\/tc filter add dev lo parent 1: protocol ip prio 1 u32  match ip dst 127.0.0.1\/32  flowid 1:10     add_u32_filter_32key(link, TC_HANDLE(0x1, 0), TC_HANDLE(0x1, 0x10), sock, prio, key);      return 0; }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u043a\u0442\u044b: \u0414\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e vlan_id \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c 802q1,  \u0444\u0438\u043b\u044c\u0442\u0440 u32 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e \u043f\u043e\u043b\u044f\u043c \u043a\u0430\u0434\u0440\u0430 802q1. \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 tc \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0431\u0435\u0437 c++, \u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e vlan \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437  \u0444\u0438\u043b\u044c\u0442\u0440 tc flower. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440 tc flower \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 nftables, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 vlan) \u0438 \u0434\u0430\u043b\u0435\u0435 \u0443\u0436\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 tc (<a href=\"https:\/\/github.com\/lIkesimba9\/libnl-3-route-examples\/tree\/main\/tc_filter_fw_by_mark\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>).<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/lIkesimba9\/libnl-3-route-examples\/tree\/main\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>. <a href=\"https:\/\/t.me\/+9fl51jd750A3MTIy\" rel=\"noopener noreferrer nofollow\">\u0415\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/877514\/\"> https:\/\/habr.com\/ru\/articles\/877514\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0442\u0438\u043b\u0438\u0442\u044b traffic control\u00a0 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libnl \u043d\u0430 \u0441\/c++. \u0423 libnl \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f <a href=\"https:\/\/www.infradead.org\/~tgr\/libnl\/doc\/route.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u0442\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/github.com\/thom311\/libnl\/tree\/main\/tests\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u0441\u0442\u043e\u0432<\/a>. \u041a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439.<\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/tc.8.html\" rel=\"noopener noreferrer nofollow\">Traffic control<\/a> \u2014 \u0443\u0442\u0438\u043b\u0438\u0442\u0430  \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u043e\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e tc \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 QoS (Quality of Service), \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c SHAPING\u00a0(\u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435), SCHEDULING (\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0438\u0437\u0430\u0446\u0438\u044f), POLICING (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435) \u0438 DROPPING (\u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u0435) \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">tc qdisc add dev lo root handle 1: htb default 20  tc class add dev lo parent 1: classid 1:1 htb rate 10240kbit  tc class add dev lo parent 1:1 classid 1:10 htb rate 100kbit ceil 10240kbit prio 1  tc class add dev lo parent 1:1 classid 1:20 htb rate 100kbit ceil 10240kbit prio 2 tc filter add dev lo parent 1: protocol ip prio 1 u32  match ip dst 127.0.0.1\/32  flowid 1:10<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430 htb (\u0448\u0435\u0439\u043f\u0435\u0440) \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 loopback (default 20 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e  \u0432\u0435\u0441\u044c \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u0435\u0441\u0451\u043d \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u0441 \u043c\u0435\u0442\u043a\u043e\u0439 20). \u0414\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0448\u0435\u0439\u043f\u0435\u0440\u0430.\u00a0 \u0424\u0438\u043b\u044c\u0442\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e ip \u0430\u0434\u0440\u0435\u0441\u0441 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 127.0.0.1\/32 \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443. \u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0438\u0436\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/vitawasalreadytaken\/tcviz\" rel=\"noopener noreferrer nofollow\">tcviz<\/a>. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libnl, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443(htb)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441(htb), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430, \u043e\u0434\u0438\u043d \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_qdisc_htb<\/code><\/p>\n<pre><code class=\"cpp\">void add_qdisc_htb(struct rtnl_link *link, uint32_t parent_handle, uint32_t handle, struct nl_sock* sock, uint32_t default_class) {     int err;     struct rtnl_qdisc *qdisc;     qdisc = rtnl_qdisc_alloc(); \/\/ \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u043e\u0434 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443     rtnl_tc_set_link(TC_CAST(qdisc), link);      rtnl_tc_set_parent(TC_CAST(qdisc), parent_handle); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441     rtnl_tc_set_handle(TC_CAST(qdisc), handle); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441     err = rtnl_tc_set_kind(TC_CAST(qdisc), \"htb\"); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b     throw_err(err);      err = rtnl_htb_set_defcls(qdisc, default_class); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     throw_err(err);      err = rtnl_qdisc_add(sock, qdisc, NLM_F_CREATE); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443     throw_err(err);     rtnl_qdisc_put(qdisc); \/\/ \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b }<\/code><\/pre>\n<p>\u0433\u0434\u0435<code>rtnl_link *link<\/code> \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443, <code>uint32_t parent_handle<\/code> &#8212; \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, <code>uint32_t handle<\/code> &#8212; \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 (\u0432\u0441\u0435 \u043c\u0435\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u044b tc \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435), <code>struct nl_sock* sock<\/code> &#8212; \u0441\u043e\u043a\u0435\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0434\u0440\u0430 linux, <code>uint32_t default_class<\/code> &#8212; \u043a\u043b\u0430\u0441\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c  \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_htb_class<\/code><\/p>\n<pre><code class=\"cpp\">void add_htb_class(struct rtnl_link *link, uint32_t parent_handle, uint32_t handle, struct nl_sock* sock,                    uint32_t rate, uint32_t ceil = 0, uint32_t prio = 0, uint32_t quantum = 0) {     int err;      struct rtnl_class *cl;      cl = rtnl_class_alloc();     rtnl_tc_set_link(TC_CAST(cl), link);     rtnl_tc_set_parent(TC_CAST(cl), parent_handle);     rtnl_tc_set_handle(TC_CAST(cl), handle);       err = rtnl_tc_set_kind(TC_CAST(cl), \"htb\");     throw_err(err);     err = rtnl_htb_set_rate(cl, rate);     throw_err(err);      if (ceil) {         err = rtnl_htb_set_ceil(cl, ceil);         throw_err(err);     }     if (prio) {         err = rtnl_htb_set_prio(cl, prio);         throw_err(err);     }     if (quantum) {         err = rtnl_htb_set_quantum(cl, quantum);         throw_err(err);     }      err = rtnl_class_add(sock, cl, NLM_F_CREATE);     throw_err(err);     rtnl_class_put(cl); } <\/code><\/pre>\n<p>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u043e\u0441\u0443 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, quantum \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/linkmeup.gitbook.io\/sdsm\/15.-qos\/6.-upravlenie-peregruzkami-congestion-management\/3-rr-round-robin\" rel=\"noopener noreferrer nofollow\">DWRR<\/a><\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>add_u32_filter_32key<\/code><\/p>\n<pre><code class=\"cpp\">void add_u32_filter_32key(struct rtnl_link *link, uint32_t handle, uint32_t flowid, struct nl_sock* sock, int prio, u32key key) {     struct rtnl_cls *filter;     int err;     filter = rtnl_cls_alloc();     rtnl_tc_set_link(TC_CAST(filter), link);     rtnl_tc_set_parent(TC_CAST(filter), handle);     err = rtnl_tc_set_kind(TC_CAST(filter), \"u32\");      throw_err(err);     rtnl_cls_set_prio(filter, prio);     rtnl_cls_set_protocol(filter, ETH_P_IP);     err = rtnl_u32_add_key_uint32(filter, key.value, key.mask, key.offset, key.keyoffmask); \/\/ \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430     throw_err(err);     err = rtnl_u32_set_classid(filter, flowid); \/\/ \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430     throw_err(err);     err = rtnl_u32_set_cls_terminal(filter);     throw_err(err);     err = rtnl_cls_add(sock, filter, NLM_F_CREATE);     throw_err(err);     rtnl_cls_put(filter); }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 u32key \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 4 \u043f\u043e\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b tc: <code>tc filtertc filter add dev lo parent 1: protocol ip prio 1 u32\u00a0 match ip dst 127.0.0.1\/32\u00a0 flowid 1:10<\/code>  \u043f\u043e\u043b\u0435 value \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ip \u0430\u0434\u0440\u0435\u0441\u0430, \u043f\u043e\u043b\u0435 mask \u0437\u0430 \u043c\u0430\u0441\u043a\u0443 \u0434\u043b\u044f ip \u0430\u0434\u0440\u0435\u0441\u0430, offset \u0437\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 ip \u043f\u0430\u043a\u0435\u0442\u0430 (\u0442.\u043a. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b ip), \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 keyoffmask \u044d\u0442\u043e \u043c\u0430\u0441\u043a\u0430 \u0434\u043b\u044f offset.<\/p>\n<pre><code class=\"cpp\">struct u32key {     uint32_t value;     uint32_t mask;     int offset;     int keyoffmask; };<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main<\/code> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<pre><code class=\"cpp\">int main() {      struct nl_cache *cache;     struct rtnl_link *link;     struct nl_sock *sock;     int if_index;     sock = nl_socket_alloc();     nl_connect(sock, NETLINK_ROUTE);     rtnl_link_alloc_cache(sock, AF_UNSPEC, &amp;cache);     link = rtnl_link_get_by_name(cache, \"lo\");       struct rtnl_qdisc *qdisc;     if (!(qdisc = rtnl_qdisc_alloc())) {         std::runtime_error(\"Can not allocate Qdisc\");     }     rtnl_tc_set_link(TC_CAST(qdisc), link);     rtnl_tc_set_parent(TC_CAST(qdisc), TC_H_ROOT);      \/\/Delete current qdisc     rtnl_qdisc_delete(sock, qdisc);     free(qdisc);        \/\/tc qdisc add dev eth1 root handle 1: htb default 20     add_qdisc_htb(link, TC_H_ROOT, TC_HANDLE(0x1, 0), sock, TC_HANDLE(0, 0x20));       \/\/tc class add dev eth1 parent 1: classid 1:1 htb rate 10240kbit     add_htb_class(link, TC_HANDLE(0x1, 0), TC_HANDLE(0x1, 0x1), sock, 1250000);      \/\/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 7168kbit     add_htb_class(link, TC_HANDLE(0x1, 0x1), TC_HANDLE(0x1, 0x10), sock, 12500, 1250000, 1);      \/\/tc class add dev eth1 parent 1:1 classid 1:20 htb rate 3072kbit ceil 10240kbit     add_htb_class(link, TC_HANDLE(0x1, 0x1), TC_HANDLE(0x1, 0x20), sock, 12500, 1250000, 2);      u32key key;     inet_pton(AF_INET, \"127.0.0.1\", &amp;(key.value));     inet_pton(AF_INET, \"255.255.255.255\", &amp;(key.mask));     key.value = ntohl(key.value);     key.mask = ntohl(key.mask);     key.offset = 16; \/\/ OFFSET_DESTINATION     int prio = 1;      \/\/tc filter add dev lo parent 1: protocol ip prio 1 u32  match ip dst 127.0.0.1\/32  flowid 1:10     add_u32_filter_32key(link, TC_HANDLE(0x1, 0), TC_HANDLE(0x1, 0x10), sock, prio, key);      return 0; }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u043a\u0442\u044b: \u0414\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e vlan_id \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c 802q1,  \u0444\u0438\u043b\u044c\u0442\u0440 u32 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e \u043f\u043e\u043b\u044f\u043c \u043a\u0430\u0434\u0440\u0430 802q1. \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 tc \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0431\u0435\u0437 c++, \u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u043e vlan \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437  \u0444\u0438\u043b\u044c\u0442\u0440 tc flower. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440 tc flower \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 nftables, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 vlan) \u0438 \u0434\u0430\u043b\u0435\u0435 \u0443\u0436\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 tc (<a href=\"https:\/\/github.com\/lIkesimba9\/libnl-3-route-examples\/tree\/main\/tc_filter_fw_by_mark\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>).<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/lIkesimba9\/libnl-3-route-examples\/tree\/main\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>. <a href=\"https:\/\/t.me\/+9fl51jd750A3MTIy\" rel=\"noopener noreferrer nofollow\">\u0415\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/877514\/\"> https:\/\/habr.com\/ru\/articles\/877514\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-446448","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/446448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=446448"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/446448\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=446448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=446448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=446448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}