diff options
Diffstat (limited to 'scripts/package-build/linux-kernel/patches')
11 files changed, 2083 insertions, 1 deletions
diff --git a/scripts/package-build/linux-kernel/patches b/scripts/package-build/linux-kernel/patches deleted file mode 120000 index fd016d35..00000000 --- a/scripts/package-build/linux-kernel/patches +++ /dev/null @@ -1 +0,0 @@ -../../../packages/linux-kernel/patches
\ No newline at end of file diff --git a/scripts/package-build/linux-kernel/patches/accel-ppp/0001-L2TP-Include-Calling-Number-to-Calling-Station-ID-RA.patch b/scripts/package-build/linux-kernel/patches/accel-ppp/0001-L2TP-Include-Calling-Number-to-Calling-Station-ID-RA.patch new file mode 100644 index 00000000..0c3141a0 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/accel-ppp/0001-L2TP-Include-Calling-Number-to-Calling-Station-ID-RA.patch @@ -0,0 +1,183 @@ +From 12778d1e9296b6dbf190a80dcf407b24f9821f95 Mon Sep 17 00:00:00 2001 +From: zsdc <taras@vyos.io> +Date: Tue, 4 Apr 2023 11:15:26 +0300 +Subject: [PATCH] L2TP: Include Calling-Number to Calling-Station-ID RADIUS + attribute + +Patch authored by Alexander Serkin from +https://phabricator.accel-ppp.org/T59 +--- + accel-pppd/ctrl/l2tp/l2tp.c | 112 ++++++++++++++++++++++++++++++------ + 1 file changed, 93 insertions(+), 19 deletions(-) + +diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c +index 027d710..c541c60 100644 +--- a/accel-pppd/ctrl/l2tp/l2tp.c ++++ b/accel-pppd/ctrl/l2tp/l2tp.c +@@ -123,6 +123,11 @@ struct l2tp_sess_t + struct l2tp_conn_t *paren_conn; + uint16_t sid; + uint16_t peer_sid; ++/* We will keep l2tp attributes Calling-Number/Called-Number and their length while the session exists */ ++ char *calling_num; ++ int calling_num_len; ++ char *called_num; ++ int called_num_len; + + unsigned int ref_count; + int state1; +@@ -979,6 +984,10 @@ static void __session_destroy(struct l2tp_sess_t *sess) + _free(sess->ctrl.calling_station_id); + if (sess->ctrl.called_station_id) + _free(sess->ctrl.called_station_id); ++ if (sess->calling_num) ++ _free(sess->calling_num); ++ if (sess->called_num) ++ _free(sess->called_num); + + log_session(log_info2, sess, "session destroyed\n"); + +@@ -1771,25 +1780,52 @@ static int l2tp_session_start_data_channel(struct l2tp_sess_t *sess) + sess->ctrl.max_mtu = conf_ppp_max_mtu; + sess->ctrl.mppe = conf_mppe; + +- sess->ctrl.calling_station_id = _malloc(17); +- if (sess->ctrl.calling_station_id == NULL) { +- log_session(log_error, sess, +- "impossible to start data channel:" +- " allocation of calling station ID failed\n"); +- goto err; ++ /* If l2tp calling number avp exists, we use it, otherwise we use lac ip */ ++ if (sess->calling_num != NULL) { ++ sess->ctrl.calling_station_id = _malloc(sess->calling_num_len+1); ++ if (sess->ctrl.calling_station_id == NULL) { ++ log_session(log_error, sess, ++ "impossible to start data channel:" ++ " allocation of calling station ID failed\n"); ++ goto err; ++ }else { ++ strcpy(sess->ctrl.calling_station_id, sess->calling_num); ++ } ++ } else { ++ sess->ctrl.calling_station_id = _malloc(17); ++ if (sess->ctrl.calling_station_id == NULL) { ++ log_session(log_error, sess, ++ "impossible to start data channel:" ++ " allocation of calling station ID failed\n"); ++ goto err; ++ } else { ++ u_inet_ntoa(sess->paren_conn->peer_addr.sin_addr.s_addr, ++ sess->ctrl.calling_station_id); ++ } + } +- u_inet_ntoa(sess->paren_conn->peer_addr.sin_addr.s_addr, +- sess->ctrl.calling_station_id); +- +- sess->ctrl.called_station_id = _malloc(17); +- if (sess->ctrl.called_station_id == NULL) { +- log_session(log_error, sess, +- "impossible to start data channel:" +- " allocation of called station ID failed\n"); +- goto err; ++ /* If l2tp called number avp exists, we use it, otherwise we use my ip */ ++ if (sess->called_num != NULL) { ++ sess->ctrl.called_station_id = _malloc(sess->called_num_len+1); ++ if (sess->ctrl.called_station_id == NULL) { ++ log_session(log_error, sess, ++ "impossible to start data channel:" ++ " allocation of called station ID failed\n"); ++ goto err; ++ } else { ++ strcpy(sess->ctrl.called_station_id, sess->called_num); ++ } ++ } else { ++ sess->ctrl.called_station_id = _malloc(17); ++ if (sess->ctrl.called_station_id == NULL) { ++ log_session(log_error, sess, ++ "impossible to start data channel:" ++ " allocation of called station ID failed\n"); ++ goto err; ++ } else { ++ u_inet_ntoa(sess->paren_conn->host_addr.sin_addr.s_addr, ++ sess->ctrl.called_station_id); ++ } + } +- u_inet_ntoa(sess->paren_conn->host_addr.sin_addr.s_addr, +- sess->ctrl.called_station_id); + + if (conf_ip_pool) { + sess->ppp.ses.ipv4_pool_name = _strdup(conf_ip_pool); +@@ -3295,6 +3331,10 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, + uint16_t sid = 0; + uint16_t res = 0; + uint16_t err = 0; ++ uint8_t *calling[254] = {0}; ++ uint8_t *called[254] = {0}; ++ int n = 0; ++ int m = 0; + + if (conn->state != STATE_ESTB && conn->lns_mode) { + log_tunnel(log_warn, conn, "discarding unexpected ICRQ\n"); +@@ -3332,7 +3372,17 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, + case Call_Serial_Number: + case Bearer_Type: + case Calling_Number: ++ /* Save Calling-Number L2TP attribute locally */ ++ if (attr->attr->id == Calling_Number) { ++ n = attr->length; ++ memcpy(calling,attr->val.octets,n); ++ } + case Called_Number: ++ /* Save Called-Number L2TP attribute locally */ ++ if (attr->attr->id == Called_Number) { ++ m = attr->length; ++ memcpy(called,attr->val.octets,m); ++ } + case Sub_Address: + case Physical_Channel_ID: + break; +@@ -3371,6 +3421,30 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, + sess->peer_sid = peer_sid; + sid = sess->sid; + ++ /* Allocate memory for Calling-Number if exists, and put it to l2tp_sess_t structure */ ++ if (calling != NULL && n > 0) { ++ sess->calling_num = _malloc(n+1); ++ if (sess->calling_num == NULL) { ++ log_tunnel(log_warn, conn, "can't allocate memory for Calling Number attribute. Will use LAC IP instead\n"); ++ }else{ ++ memcpy(sess->calling_num, calling, n); ++ sess->calling_num[n] = '\0'; ++ sess->calling_num_len = n; ++ } ++ } ++ ++ /* Allocate memory for Called-Number if exists, and put it to l2tp_sess_t structure */ ++ if (called != NULL && m > 1) { ++ sess->called_num = _malloc(m+1); ++ if (sess->called_num == NULL) { ++ log_tunnel(log_warn, conn, "can't allocate memory for Called Number attribute. Will use my IP instead\n"); ++ } else { ++ memcpy(sess->called_num, called, m); ++ sess->called_num[m] = '\0'; ++ sess->called_num_len = m; ++ } ++ } ++ + if (unknown_attr) { + log_tunnel(log_error, conn, "impossible to handle ICRQ:" + " unknown mandatory attribute type %i," +@@ -3390,8 +3464,8 @@ static int l2tp_recv_ICRQ(struct l2tp_conn_t *conn, + goto out_reject; + } + +- log_tunnel(log_info1, conn, "new session %hu-%hu created following" +- " reception of ICRQ\n", sid, peer_sid); ++ log_tunnel(log_info1, conn, "new session %hu-%hu with calling num %s len %d, called num %s len %d created following" ++ " reception of ICRQ\n", sid, peer_sid, sess->calling_num, sess->calling_num_len, sess->called_num, sess->called_num_len); + + return 0; + +-- +2.34.1 + diff --git a/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Add-vrf-support-for-Framed-Route-and-Framed-IPv6-Rou.patch b/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Add-vrf-support-for-Framed-Route-and-Framed-IPv6-Rou.patch new file mode 100644 index 00000000..b963050f --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Add-vrf-support-for-Framed-Route-and-Framed-IPv6-Rou.patch @@ -0,0 +1,639 @@ +From 5587c45d9e3264f45eba636941cf80b90f2f6186 Mon Sep 17 00:00:00 2001 +From: Chris Hills <chris@brsk.co.uk> +Date: Thu, 29 Jun 2023 09:24:36 +0100 +Subject: [PATCH 2/4] Add vrf support for Framed-Route and Framed-IPv6-Route + +(cherry picked from commit 899dc375fe01672a5eae2d7f7db81edc0d2a4440) +--- + accel-pppd/CMakeLists.txt | 4 + + accel-pppd/ctrl/ipoe/ipoe.c | 20 ++++ + accel-pppd/ifcfg.c | 6 +- + accel-pppd/ipv6/dhcpv6.c | 8 ++ + accel-pppd/libnetlink/iputils.c | 110 ++++++++++++++++- + accel-pppd/libnetlink/iputils.h | 11 ++ + accel-pppd/libnetlink/rt_names.c | 196 +++++++++++++++++++++++++++++++ + accel-pppd/libnetlink/rt_names.h | 14 +++ + accel-pppd/radius/radius.c | 21 +++- + 9 files changed, 384 insertions(+), 6 deletions(-) + create mode 100644 accel-pppd/libnetlink/rt_names.c + create mode 100644 accel-pppd/libnetlink/rt_names.h + +diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt +index ab8a350..c3995ea 100644 +--- a/accel-pppd/CMakeLists.txt ++++ b/accel-pppd/CMakeLists.txt +@@ -123,6 +123,10 @@ ADD_EXECUTABLE(accel-pppd + main.c + ) + ++IF (DEFINED HAVE_VRF) ++ target_sources(accel-pppd PRIVATE libnetlink/rt_names.c) ++ENDIF (DEFINED HAVE_VRF) ++ + TARGET_LINK_LIBRARIES(accel-pppd triton rt pthread ${crypto_lib} pcre) + set_property(TARGET accel-pppd PROPERTY CMAKE_SKIP_BUILD_RPATH FALSE) + set_property(TARGET accel-pppd PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c +index 61b7c23..6f23fd6 100644 +--- a/accel-pppd/ctrl/ipoe/ipoe.c ++++ b/accel-pppd/ctrl/ipoe/ipoe.c +@@ -1067,9 +1067,17 @@ static void __ipoe_session_activate(struct ipoe_session *ses) + + if (ses->ifindex == -1 && !serv->opt_ifcfg) { + if (!serv->opt_ip_unnumbered) ++#ifdef HAVE_VRF ++ iproute_add(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0, NULL); ++#else + iproute_add(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0); ++#endif + else ++#ifdef HAVE_VRF ++ iproute_add(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); ++#else + iproute_add(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0); ++#endif + } + + if (ses->l4_redirect) +@@ -1170,7 +1178,11 @@ static void ipoe_session_started(struct ap_session *s) + + if (ses->ses.ipv4->peer_addr != ses->yiaddr) + //ipaddr_add_peer(ses->ses.ifindex, ses->router, ses->yiaddr); // breaks quagga ++#ifdef HAVE_VRF ++ iproute_add(ses->ses.ifindex, ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); ++#else + iproute_add(ses->ses.ifindex, ses->router, ses->yiaddr, 0, conf_proto, 32, 0); ++#endif + + if (ses->ifindex != -1 && ses->xid) { + ses->dhcpv4 = dhcpv4_create(ses->ctrl.ctx, ses->ses.ifname, ""); +@@ -1254,9 +1266,17 @@ static void ipoe_session_finished(struct ap_session *s) + } else if (ses->started) { + if (!serv->opt_ifcfg) { + if (!serv->opt_ip_unnumbered) ++#ifdef HAVE_VRF ++ iproute_del(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0, NULL); ++#else + iproute_del(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0); ++#endif + else ++#ifdef HAVE_VRF ++ iproute_del(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); ++#else + iproute_del(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0); ++#endif + } + } + +diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c +index 3750060..3b1848e 100644 +--- a/accel-pppd/ifcfg.c ++++ b/accel-pppd/ifcfg.c +@@ -234,7 +234,11 @@ void __export ap_session_ifdown(struct ap_session *ses) + if (!a->installed) + continue; + if (a->prefix_len > 64) ++#ifdef HAVE_VRF ++ ip6route_del(ses->ifindex, &a->addr, a->prefix_len, NULL, 0, 0, ses->vrf_name); ++#else + ip6route_del(ses->ifindex, &a->addr, a->prefix_len, NULL, 0, 0); ++#endif + else { + struct in6_addr addr; + memcpy(addr.s6_addr, &a->addr, 8); +@@ -376,4 +380,4 @@ int __export ap_session_vrf(struct ap_session *ses, const char *vrf_name, int le + + return 0; + } +-#endif +\ No newline at end of file ++#endif +diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c +index 158771b..41e6c3f 100644 +--- a/accel-pppd/ipv6/dhcpv6.c ++++ b/accel-pppd/ipv6/dhcpv6.c +@@ -159,7 +159,11 @@ static void ev_ses_finished(struct ap_session *ses) + if (pd->dp_active) { + struct ipv6db_addr_t *p; + list_for_each_entry(p, &ses->ipv6_dp->prefix_list, entry) ++#ifdef HAVE_VRF ++ ip6route_del(0, &p->addr, p->prefix_len, NULL, 0, 0, ses->vrf_name); ++#else + ip6route_del(0, &p->addr, p->prefix_len, NULL, 0, 0); ++#endif + } + + ipdb_put_ipv6_prefix(ses, ses->ipv6_dp); +@@ -181,7 +185,11 @@ static void insert_dp_routes(struct ap_session *ses, struct dhcpv6_pd *pd, struc + addr = NULL; + + list_for_each_entry(p, &ses->ipv6_dp->prefix_list, entry) { ++#ifdef HAVE_VRF ++ if (ip6route_add(ses->ifindex, &p->addr, p->prefix_len, addr, 0, 0, ses->vrf_name)) { ++#else + if (ip6route_add(ses->ifindex, &p->addr, p->prefix_len, addr, 0, 0)) { ++#endif + err = errno; + inet_ntop(AF_INET6, &p->addr, str1, sizeof(str1)); + if (addr) +diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c +index 23325fc..6c61fc2 100644 +--- a/accel-pppd/libnetlink/iputils.c ++++ b/accel-pppd/libnetlink/iputils.c +@@ -11,7 +11,9 @@ + #include <errno.h> + #include <time.h> + #include <sys/uio.h> +-//#include <linux/if_link.h> ++#ifdef HAVE_VRF ++#include <linux/if_link.h> ++#endif + //#include <linux/if_addr.h> + //#include <linux/rtnetlink.h> + #include <linux/fib_rules.h> +@@ -21,6 +23,9 @@ + #include "libnetlink.h" + #include "iputils.h" + #include "ap_net.h" ++#ifdef HAVE_VRF ++#include "rt_names.h" ++#endif + + #ifdef ACCEL_DP + #define _malloc(x) malloc(x) +@@ -457,7 +462,82 @@ int __export ipaddr_del_peer(int ifindex, in_addr_t addr, in_addr_t peer) + return r; + } + ++#ifdef HAVE_VRF ++__u32 ipvrf_get_table(const char *vrf_name) ++{ ++ struct iplink_req { ++ struct nlmsghdr n; ++ struct ifinfomsg i; ++ char buf[4096]; ++ } req; ++ struct rtnl_handle *rth = net->rtnl_get(); ++ struct rtattr *tb[IFLA_MAX+1]; ++ struct rtattr *li[IFLA_INFO_MAX+1]; ++ struct rtattr *vrf_attr[IFLA_VRF_MAX + 1]; ++ struct ifinfomsg *ifi; ++ int len; ++ __u32 tb_id = RT_TABLE_MAIN; ++ ++ log_ppp_info2("utils: getting route table for %s\n", vrf_name); ++ ++ if (!vrf_name) ++ return tb_id; ++ ++ memset(&req, 0, sizeof(req) - 4096); ++ ++ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); ++ req.n.nlmsg_flags = NLM_F_REQUEST; ++ req.n.nlmsg_type = RTM_GETLINK; ++ req.i.ifi_family = AF_UNSPEC; ++ ++ addattr_l(&req.n, 4096, IFLA_IFNAME, vrf_name, strlen(vrf_name)); ++ ++ if (rtnl_talk(rth, &req.n, 0, 0, &req.n, NULL, NULL, 0) < 0) { ++ if (errno == ENODEV && !strcmp(vrf_name, "default")) ++ if (rtnl_rttable_a2n(&tb_id, "main")) ++ log_ppp_error( ++ "BUG: route table \"main\" not found.\n"); ++ return tb_id; ++ } ++ ++ ifi = NLMSG_DATA(&req.n); ++ ++ len = req.n.nlmsg_len; ++ ++ len -= NLMSG_LENGTH(sizeof(*ifi)); ++ if (len < 0) ++ goto out; ++ ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); ++ ++ if (!tb[IFLA_LINKINFO]) ++ goto out; ++ ++ parse_rtattr_nested(li, IFLA_INFO_MAX, tb[IFLA_LINKINFO]); ++ ++ if (!li[IFLA_INFO_KIND] || !li[IFLA_INFO_DATA]) ++ goto out; ++ ++ if (strcmp(RTA_DATA(li[IFLA_INFO_KIND]), "vrf")) ++ goto out; ++ ++ parse_rtattr_nested(vrf_attr, IFLA_VRF_MAX, li[IFLA_INFO_DATA]); ++ if (vrf_attr[IFLA_VRF_TABLE]) ++ tb_id = *(__u32 *)RTA_DATA(vrf_attr[IFLA_VRF_TABLE]); ++ ++ if (!tb_id) ++ log_ppp_error("BUG: VRF %s is missing table id\n", vrf_name); ++ ++out: ++ return tb_id; ++} ++#endif ++ ++#ifdef HAVE_VRF ++int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name) ++#else + int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio) ++#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -472,11 +552,17 @@ int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + + memset(&req, 0, sizeof(req) - 4096); + ++#ifdef HAVE_VRF ++ __u32 rt_table = ipvrf_get_table(vrf_name); ++#else ++ __u32 rt_table = RT_TABLE_MAIN; ++#endif ++ + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); + req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE; + req.n.nlmsg_type = RTM_NEWROUTE; + req.i.rtm_family = AF_INET; +- req.i.rtm_table = RT_TABLE_MAIN; ++ req.i.rtm_table = rt_table; + req.i.rtm_scope = gw ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK; + req.i.rtm_protocol = proto; + req.i.rtm_type = RTN_UNICAST; +@@ -500,7 +586,11 @@ int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + return r; + } + ++#ifdef HAVE_VRF ++int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name) ++#else + int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio) ++#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -543,7 +633,11 @@ int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + return r; + } + ++#ifdef HAVE_VRF ++int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name) ++#else + int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio) ++#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -558,11 +652,17 @@ int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, + + memset(&req, 0, sizeof(req) - 4096); + ++#ifdef HAVE_VRF ++ __u32 rt_table = ipvrf_get_table(vrf_name); ++#else ++ __u32 rt_table = RT_TABLE_MAIN; ++#endif ++ + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); + req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE; + req.n.nlmsg_type = RTM_NEWROUTE; + req.i.rtm_family = AF_INET6; +- req.i.rtm_table = RT_TABLE_MAIN; ++ req.i.rtm_table = rt_table; + req.i.rtm_scope = RT_SCOPE_UNIVERSE; + req.i.rtm_protocol = proto; + req.i.rtm_type = RTN_UNICAST; +@@ -584,7 +684,11 @@ int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, + return r; + } + ++#ifdef HAVE_VRF ++int __export ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name) ++#else + int __export ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio) ++#endif + { + struct ipaddr_req { + struct nlmsghdr n; +diff --git a/accel-pppd/libnetlink/iputils.h b/accel-pppd/libnetlink/iputils.h +index 9292cea..c3063f4 100644 +--- a/accel-pppd/libnetlink/iputils.h ++++ b/accel-pppd/libnetlink/iputils.h +@@ -4,6 +4,7 @@ + #include <linux/if_link.h> + #include <netinet/in.h> + #include <stdint.h> ++#include <config.h> + + typedef int (*iplink_list_func)(int index, int flags, const char *name, int iflink, int vid, void *arg); + +@@ -20,12 +21,22 @@ int ipaddr_add_peer(int ifindex, in_addr_t addr, in_addr_t peer_addr); + int ipaddr_del(int ifindex, in_addr_t addr, int mask); + int ipaddr_del_peer(int ifindex, in_addr_t addr, in_addr_t peer); + ++#ifdef HAVE_VRF ++int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name); ++int iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name); ++#else + int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio); + int iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio); ++#endif + in_addr_t iproute_get(in_addr_t dst, in_addr_t *gw); + ++#ifdef HAVE_VRF ++int ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name); ++int ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name); ++#else + int ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio); + int ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio); ++#endif + int ip6addr_add(int ifindex, struct in6_addr *addr, int prefix_len); + int ip6addr_add_peer(int ifindex, struct in6_addr *addr, struct in6_addr *peer_addr); + int ip6addr_del(int ifindex, struct in6_addr *addr, int prefix_len); +diff --git a/accel-pppd/libnetlink/rt_names.c b/accel-pppd/libnetlink/rt_names.c +new file mode 100644 +index 0000000..5591a67 +--- /dev/null ++++ b/accel-pppd/libnetlink/rt_names.c +@@ -0,0 +1,196 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * rt_names.c rtnetlink names DB. ++ * ++ * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> ++ */ ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <fcntl.h> ++#include <string.h> ++#include <sys/time.h> ++#include <sys/socket.h> ++#include <dirent.h> ++#include <limits.h> ++ ++#include <asm/types.h> ++#include <linux/rtnetlink.h> ++ ++#include "rt_names.h" ++#include "utils.h" ++ ++#define NAME_MAX_LEN 512 ++#define CONFDIR "/etc/iproute2" ++ ++int numeric; ++ ++struct rtnl_hash_entry { ++ struct rtnl_hash_entry *next; ++ const char *name; ++ unsigned int id; ++}; ++ ++static int fread_id_name(FILE *fp, int *id, char *namebuf) ++{ ++ char buf[NAME_MAX_LEN]; ++ ++ while (fgets(buf, sizeof(buf), fp)) { ++ char *p = buf; ++ ++ while (*p == ' ' || *p == '\t') ++ p++; ++ ++ if (*p == '#' || *p == '\n' || *p == 0) ++ continue; ++ ++ if (sscanf(p, "0x%x %s\n", id, namebuf) != 2 && ++ sscanf(p, "0x%x %s #", id, namebuf) != 2 && ++ sscanf(p, "%d %s\n", id, namebuf) != 2 && ++ sscanf(p, "%d %s #", id, namebuf) != 2) { ++ strcpy(namebuf, p); ++ return -1; ++ } ++ return 1; ++ } ++ return 0; ++} ++ ++static void ++rtnl_hash_initialize(const char *file, struct rtnl_hash_entry **hash, int size) ++{ ++ struct rtnl_hash_entry *entry; ++ FILE *fp; ++ int id; ++ char namebuf[NAME_MAX_LEN] = {0}; ++ int ret; ++ ++ fp = fopen(file, "r"); ++ if (!fp) ++ return; ++ ++ while ((ret = fread_id_name(fp, &id, &namebuf[0]))) { ++ if (ret == -1) { ++ fprintf(stderr, "Database %s is corrupted at %s\n", ++ file, namebuf); ++ fclose(fp); ++ return; ++ } ++ ++ if (id < 0) ++ continue; ++ ++ entry = malloc(sizeof(*entry)); ++ if (entry == NULL) { ++ fprintf(stderr, "malloc error: for entry\n"); ++ break; ++ } ++ entry->id = id; ++ entry->name = strdup(namebuf); ++ entry->next = hash[id & (size - 1)]; ++ hash[id & (size - 1)] = entry; ++ } ++ fclose(fp); ++} ++ ++static struct rtnl_hash_entry dflt_table_entry = { .name = "default" }; ++static struct rtnl_hash_entry main_table_entry = { .name = "main" }; ++static struct rtnl_hash_entry local_table_entry = { .name = "local" }; ++ ++static struct rtnl_hash_entry *rtnl_rttable_hash[256] = { ++ [RT_TABLE_DEFAULT] = &dflt_table_entry, ++ [RT_TABLE_MAIN] = &main_table_entry, ++ [RT_TABLE_LOCAL] = &local_table_entry, ++}; ++ ++static int rtnl_rttable_init; ++ ++static void rtnl_rttable_initialize(void) ++{ ++ struct dirent *de; ++ DIR *d; ++ int i; ++ ++ rtnl_rttable_init = 1; ++ for (i = 0; i < 256; i++) { ++ if (rtnl_rttable_hash[i]) ++ rtnl_rttable_hash[i]->id = i; ++ } ++ rtnl_hash_initialize(CONFDIR "/rt_tables", ++ rtnl_rttable_hash, 256); ++ ++ d = opendir(CONFDIR "/rt_tables.d"); ++ if (!d) ++ return; ++ ++ while ((de = readdir(d)) != NULL) { ++ char path[PATH_MAX]; ++ size_t len; ++ ++ if (*de->d_name == '.') ++ continue; ++ ++ /* only consider filenames ending in '.conf' */ ++ len = strlen(de->d_name); ++ if (len <= 5) ++ continue; ++ if (strcmp(de->d_name + len - 5, ".conf")) ++ continue; ++ ++ snprintf(path, sizeof(path), ++ CONFDIR "/rt_tables.d/%s", de->d_name); ++ rtnl_hash_initialize(path, rtnl_rttable_hash, 256); ++ } ++ closedir(d); ++} ++ ++const char *rtnl_rttable_n2a(__u32 id, char *buf, int len) ++{ ++ struct rtnl_hash_entry *entry; ++ ++ if (!rtnl_rttable_init) ++ rtnl_rttable_initialize(); ++ entry = rtnl_rttable_hash[id & 255]; ++ while (entry && entry->id != id) ++ entry = entry->next; ++ if (!numeric && entry) ++ return entry->name; ++ snprintf(buf, len, "%u", id); ++ return buf; ++} ++ ++int rtnl_rttable_a2n(__u32 *id, const char *arg) ++{ ++ static const char *cache; ++ static unsigned long res; ++ struct rtnl_hash_entry *entry; ++ char *end; ++ unsigned long i; ++ ++ if (cache && strcmp(cache, arg) == 0) { ++ *id = res; ++ return 0; ++ } ++ ++ if (!rtnl_rttable_init) ++ rtnl_rttable_initialize(); ++ ++ for (i = 0; i < 256; i++) { ++ entry = rtnl_rttable_hash[i]; ++ while (entry && strcmp(entry->name, arg)) ++ entry = entry->next; ++ if (entry) { ++ cache = entry->name; ++ res = entry->id; ++ *id = res; ++ return 0; ++ } ++ } ++ ++ i = strtoul(arg, &end, 0); ++ if (!end || end == arg || *end || i > RT_TABLE_MAX) ++ return -1; ++ *id = i; ++ return 0; ++} +diff --git a/accel-pppd/libnetlink/rt_names.h b/accel-pppd/libnetlink/rt_names.h +new file mode 100644 +index 0000000..2ba6fe9 +--- /dev/null ++++ b/accel-pppd/libnetlink/rt_names.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef RT_NAMES_H_ ++#define RT_NAMES_H_ 1 ++ ++#include <asm/types.h> ++ ++const char *rtnl_rttable_n2a(__u32 id, char *buf, int len); ++const char *rtnl_dsfield_get_name(int id); ++ ++int rtnl_rttable_a2n(__u32 *id, const char *arg); ++ ++extern int numeric; ++ ++#endif +diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c +index 2406ba0..a45666f 100644 +--- a/accel-pppd/radius/radius.c ++++ b/accel-pppd/radius/radius.c +@@ -313,6 +313,7 @@ int rad_proc_attrs(struct rad_req_t *req) + } else if (attr->vendor->id == VENDOR_Accel_PPP) { + switch (attr->attr->id) { + case Accel_VRF_Name: ++ log_ppp_info2("radius: setting vrf_name to %s\n", attr->val.string); + if (rpd->ses->vrf_name) + _free(rpd->ses->vrf_name); + rpd->ses->vrf_name = _malloc(attr->len + 1); +@@ -642,15 +643,23 @@ static void ses_started(struct ap_session *ses) + char nbuf[INET6_ADDRSTRLEN]; + char gwbuf[INET6_ADDRSTRLEN]; + ++#ifdef HAVE_VRF ++ if (ip6route_add(gw_spec ? 0 : rpd->ses->ifindex, &fr6->prefix, fr6->plen, gw_spec ? &fr6->gw : NULL, 3, fr6->prio, rpd->ses->vrf_name)) { ++#else + if (ip6route_add(gw_spec ? 0 : rpd->ses->ifindex, &fr6->prefix, fr6->plen, gw_spec ? &fr6->gw : NULL, 3, fr6->prio)) { ++#endif + log_ppp_warn("radius: failed to add route %s/%hhu %s %u\n", +- u_ip6str(&fr6->prefix, nbuf), fr6->plen, +- u_ip6str(&fr6->gw, gwbuf), fr6->prio); ++ u_ip6str(&fr6->prefix, nbuf), fr6->plen, ++ u_ip6str(&fr6->gw, gwbuf), fr6->prio); + } + } + + for (fr = rpd->fr; fr; fr = fr->next) { ++#ifdef HAVE_VRF ++ if (iproute_add(fr->gw ? 0 : rpd->ses->ifindex, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio, rpd->ses->vrf_name)) { ++#else + if (iproute_add(fr->gw ? 0 : rpd->ses->ifindex, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio)) { ++#endif + char dst[17], gw[17]; + u_inet_ntoa(fr->dst, dst); + u_inet_ntoa(fr->gw, gw); +@@ -689,12 +698,20 @@ static void ses_finishing(struct ap_session *ses) + * when the interface is removed. + */ + if (!IN6_IS_ADDR_UNSPECIFIED(&fr6->gw)) ++#ifdef HAVE_VRF ++ ip6route_del(0, &fr6->prefix, fr6->plen, &fr6->gw, 3, fr6->prio, rpd->ses->vrf_name); ++#else + ip6route_del(0, &fr6->prefix, fr6->plen, &fr6->gw, 3, fr6->prio); ++#endif + } + + for (fr = rpd->fr; fr; fr = fr->next) { + if (fr->gw) ++#ifdef HAVE_VRF ++ iproute_del(0, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio, rpd->ses->vrf_name); ++#else + iproute_del(0, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio); ++#endif + } + + if (rpd->acct_started || rpd->acct_req) +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Radius-Dns-Server-IPv6-Address.patch b/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Radius-Dns-Server-IPv6-Address.patch new file mode 100644 index 00000000..a8991801 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/accel-ppp/0002-Radius-Dns-Server-IPv6-Address.patch @@ -0,0 +1,195 @@ +From: Ben Hardill <ben@hardill.me.uk> +Date: Tue, 13 Mar 2025 05:00:00 +0000 +Subject: [PATCH] PPPoE: IPv6 DNS from Radius - managing the DNS-Server-IPv6-Address attribute + +Patch authored by Ben Hardill from +https://github.com/accel-ppp/accel-ppp/pull/69 +--- +diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h +index 70515133..507eae04 100644 +--- a/accel-pppd/include/ap_session.h ++++ b/accel-pppd/include/ap_session.h +@@ -84,6 +84,7 @@ struct ap_session + struct ipv4db_item_t *ipv4; + struct ipv6db_item_t *ipv6; + struct ipv6db_prefix_t *ipv6_dp; ++ struct ipv6db_item_t *ipv6_dns; + char *ipv4_pool_name; + char *ipv6_pool_name; + char *dpv6_pool_name; +diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c +index 158771b1..1ef48132 100644 +--- a/accel-pppd/ipv6/dhcpv6.c ++++ b/accel-pppd/ipv6/dhcpv6.c +@@ -214,19 +214,41 @@ static void insert_status(struct dhcpv6_packet *pkt, struct dhcpv6_option *opt, + status->code = htons(code); + } + +-static void insert_oro(struct dhcpv6_packet *reply, struct dhcpv6_option *opt) ++static void insert_oro(struct dhcpv6_packet *reply, struct dhcpv6_option *opt, struct ap_session *ses) + { + struct dhcpv6_option *opt1; +- int i, j; ++ int i = 0, j = 0, k = 0; + uint16_t *ptr; + struct in6_addr addr, *addr_ptr; ++ struct ipv6db_addr_t *dns; + + for (i = ntohs(opt->hdr->len) / 2, ptr = (uint16_t *)opt->hdr->data; i; i--, ptr++) { + if (ntohs(*ptr) == D6_OPTION_DNS_SERVERS) { +- if (conf_dns_count) { +- opt1 = dhcpv6_option_alloc(reply, D6_OPTION_DNS_SERVERS, conf_dns_count * sizeof(addr)); +- for (j = 0, addr_ptr = (struct in6_addr *)opt1->hdr->data; j < conf_dns_count; j++, addr_ptr++) +- memcpy(addr_ptr, conf_dns + j, sizeof(addr)); ++ if (ses->ipv6_dns && !list_empty(&ses->ipv6_dns->addr_list)) { ++ list_for_each_entry(dns, &ses->ipv6_dns->addr_list, entry) { ++ j++; ++ } ++ if (j >= 3) { ++ j = 3; ++ } ++ opt1 = dhcpv6_option_alloc(reply, D6_OPTION_DNS_SERVERS, j * sizeof(addr)); ++ addr_ptr = (struct in6_addr *)opt1->hdr->data; ++ list_for_each_entry(dns, &ses->ipv6_dns->addr_list, entry) { ++ if (k < j) { ++ memcpy(addr_ptr, &dns->addr, sizeof(addr)); ++ k++; ++ addr_ptr++; ++ } else { ++ break; ++ } ++ } ++ ++ } else { ++ if (conf_dns_count) { ++ opt1 = dhcpv6_option_alloc(reply, D6_OPTION_DNS_SERVERS, conf_dns_count * sizeof(addr)); ++ for (j = 0, addr_ptr = (struct in6_addr *)opt1->hdr->data; j < conf_dns_count; j++, addr_ptr++) ++ memcpy(addr_ptr, conf_dns + j, sizeof(addr)); ++ } + } + } else if (ntohs(*ptr) == D6_OPTION_DOMAIN_LIST) { + if (conf_dnssl_size) { +@@ -434,7 +456,10 @@ static void dhcpv6_send_reply(struct dhcpv6_packet *req, struct dhcpv6_pd *pd, i + + // Option Request + } else if (ntohs(opt->hdr->code) == D6_OPTION_ORO) { +- insert_oro(reply, opt); ++ if (ses->ipv6_dns &&!list_empty(&ses->ipv6_dns->addr_list)) { ++ log_ppp_info2("User specific IPv6 DNS entries\n"); ++ } ++ insert_oro(reply, opt, ses); + + } else if (ntohs(opt->hdr->code) == D6_OPTION_RAPID_COMMIT) { + if (req->hdr->type == D6_SOLICIT) +@@ -594,7 +619,7 @@ static void dhcpv6_send_reply2(struct dhcpv6_packet *req, struct dhcpv6_pd *pd, + } + // Option Request + } else if (ntohs(opt->hdr->code) == D6_OPTION_ORO) +- insert_oro(reply, opt); ++ insert_oro(reply, opt, ses); + } + + opt1 = dhcpv6_option_alloc(reply, D6_OPTION_PREFERENCE, 1); +diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c +index 297e4d63..b3054274 100644 +--- a/accel-pppd/ipv6/nd.c ++++ b/accel-pppd/ipv6/nd.c +@@ -174,7 +174,32 @@ static void ipv6_nd_send_ra(struct ipv6_nd_handler_t *h, struct sockaddr_in6 *ds + rinfo++; + }*/ + +- if (conf_dns_count) { ++ if (ses->ipv6_dns && !list_empty(&ses->ipv6_dns->addr_list)) { ++ int i = 0, j = 0; ++ struct ipv6db_addr_t *dns; ++ ++ list_for_each_entry(dns, &ses->ipv6_dns->addr_list, entry) { ++ i++; ++ } ++ if (i >= 3) { ++ i = 3; ++ } ++ rdnssinfo = (struct nd_opt_rdnss_info_local *)pinfo; ++ memset(rdnssinfo, 0, sizeof(*rdnssinfo)); ++ rdnssinfo->nd_opt_rdnssi_type = ND_OPT_RDNSS_INFORMATION; ++ rdnssinfo->nd_opt_rdnssi_len = 1 + 2 * i; ++ rdnssinfo->nd_opt_rdnssi_lifetime = htonl(conf_rdnss_lifetime); ++ rdnss_addr = (struct in6_addr *)rdnssinfo->nd_opt_rdnssi; ++ list_for_each_entry(dns, &ses->ipv6_dns->addr_list, entry) { ++ if (j < i) { ++ memcpy(rdnss_addr, &dns->addr, sizeof(*rdnss_addr)); ++ j++; ++ rdnss_addr++; ++ } else { ++ break; ++ } ++ } ++ } else if (conf_dns_count) { + rdnssinfo = (struct nd_opt_rdnss_info_local *)pinfo; + memset(rdnssinfo, 0, sizeof(*rdnssinfo)); + rdnssinfo->nd_opt_rdnssi_type = ND_OPT_RDNSS_INFORMATION; +diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c +index 786faa56..1379b0b2 100644 +--- a/accel-pppd/radius/radius.c ++++ b/accel-pppd/radius/radius.c +@@ -403,6 +403,12 @@ int rad_proc_attrs(struct rad_req_t *req) + case Framed_IPv6_Route: + rad_add_framed_ipv6_route(attr->val.string, rpd); + break; ++ case DNS_Server_IPv6_Address: ++ a = _malloc(sizeof(*a)); ++ memset(a, 0, sizeof(*a)); ++ a->addr = attr->val.ipv6addr; ++ list_add_tail(&a->entry, &rpd->ipv6_dns.addr_list); ++ break; + } + } + +@@ -420,6 +426,9 @@ int rad_proc_attrs(struct rad_req_t *req) + if (!rpd->ses->ipv6_dp && !list_empty(&rpd->ipv6_dp.prefix_list)) + rpd->ses->ipv6_dp = &rpd->ipv6_dp; + ++ if (!rpd->ses->ipv6_dns && !list_empty(&rpd->ipv6_dns.addr_list)) ++ rpd->ses->ipv6_dns = &rpd->ipv6_dns; ++ + return res; + } + +@@ -584,10 +593,12 @@ static void ses_starting(struct ap_session *ses) + INIT_LIST_HEAD(&rpd->plugin_list); + INIT_LIST_HEAD(&rpd->ipv6_addr.addr_list); + INIT_LIST_HEAD(&rpd->ipv6_dp.prefix_list); ++ INIT_LIST_HEAD(&rpd->ipv6_dns.addr_list); + + rpd->ipv4_addr.owner = &ipdb; + rpd->ipv6_addr.owner = &ipdb; + rpd->ipv6_dp.owner = &ipdb; ++ rpd->ipv6_dns.owner = &ipdb; + + list_add_tail(&rpd->pd.entry, &ses->pd_list); + +@@ -764,6 +775,12 @@ static void ses_finished(struct ap_session *ses) + _free(a); + } + ++ while (!list_empty(&rpd->ipv6_dns.addr_list)) { ++ a = list_entry(rpd->ipv6_dns.addr_list.next, typeof(*a), entry); ++ list_del(&a->entry); ++ _free(a); ++ } ++ + fr6 = rpd->fr6; + while (fr6) { + struct framed_ip6_route *next = fr6->next; +diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h +index 988f154f..eaa5acb0 100644 +--- a/accel-pppd/radius/radius_p.h ++++ b/accel-pppd/radius/radius_p.h +@@ -65,6 +65,7 @@ struct radius_pd_t { + struct ipv4db_item_t ipv4_addr; + struct ipv6db_item_t ipv6_addr; + struct ipv6db_prefix_t ipv6_dp; ++ struct ipv6db_item_t ipv6_dns; + int acct_interim_interval; + int acct_interim_jitter; + diff --git a/scripts/package-build/linux-kernel/patches/accel-ppp/0003-Simplify-implementation-of-vrf-support-for-iproute_a.patch b/scripts/package-build/linux-kernel/patches/accel-ppp/0003-Simplify-implementation-of-vrf-support-for-iproute_a.patch new file mode 100644 index 00000000..3c8fff94 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/accel-ppp/0003-Simplify-implementation-of-vrf-support-for-iproute_a.patch @@ -0,0 +1,213 @@ +From 4898832b90a6b929b8316fe55085b14c3afcf4a8 Mon Sep 17 00:00:00 2001 +From: Chris Hills <chris@brsk.co.uk> +Date: Mon, 3 Jul 2023 14:42:22 +0100 +Subject: [PATCH 3/4] Simplify implementation of vrf support for + iproute_add/del + +(cherry picked from commit 85cbd27bd440e0a4836bb9e03c933e05fd321769) +--- + accel-pppd/ctrl/ipoe/ipoe.c | 24 ++---------------------- + accel-pppd/libnetlink/iputils.c | 16 ---------------- + accel-pppd/libnetlink/iputils.h | 5 ----- + accel-pppd/radius/radius.c | 16 ---------------- + accel-pppd/session.c | 1 + + 5 files changed, 3 insertions(+), 59 deletions(-) + +diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c +index 6f23fd6..3a6c85b 100644 +--- a/accel-pppd/ctrl/ipoe/ipoe.c ++++ b/accel-pppd/ctrl/ipoe/ipoe.c +@@ -1021,9 +1021,9 @@ static void __ipoe_session_activate(struct ipoe_session *ses) + in_addr_t gw; + iproute_get(ses->router, &gw, NULL); + if (gw) +- iproute_add(0, ses->siaddr, ses->yiaddr, gw, conf_proto, 32); ++ iproute_add(0, ses->siaddr, ses->yiaddr, gw, conf_proto, 32, NULL); + else +- iproute_add(0, ses->siaddr, ses->router, gw, conf_proto, 32); ++ iproute_add(0, ses->siaddr, ses->router, gw, conf_proto, 32, NULL); + }*/ + + if (serv->opt_mode == MODE_L3) +@@ -1067,17 +1067,9 @@ static void __ipoe_session_activate(struct ipoe_session *ses) + + if (ses->ifindex == -1 && !serv->opt_ifcfg) { + if (!serv->opt_ip_unnumbered) +-#ifdef HAVE_VRF + iproute_add(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0, NULL); +-#else +- iproute_add(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0); +-#endif + else +-#ifdef HAVE_VRF + iproute_add(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); +-#else +- iproute_add(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0); +-#endif + } + + if (ses->l4_redirect) +@@ -1178,11 +1170,7 @@ static void ipoe_session_started(struct ap_session *s) + + if (ses->ses.ipv4->peer_addr != ses->yiaddr) + //ipaddr_add_peer(ses->ses.ifindex, ses->router, ses->yiaddr); // breaks quagga +-#ifdef HAVE_VRF + iproute_add(ses->ses.ifindex, ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); +-#else +- iproute_add(ses->ses.ifindex, ses->router, ses->yiaddr, 0, conf_proto, 32, 0); +-#endif + + if (ses->ifindex != -1 && ses->xid) { + ses->dhcpv4 = dhcpv4_create(ses->ctrl.ctx, ses->ses.ifname, ""); +@@ -1266,17 +1254,9 @@ static void ipoe_session_finished(struct ap_session *s) + } else if (ses->started) { + if (!serv->opt_ifcfg) { + if (!serv->opt_ip_unnumbered) +-#ifdef HAVE_VRF + iproute_del(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0, NULL); +-#else +- iproute_del(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0); +-#endif + else +-#ifdef HAVE_VRF + iproute_del(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0, NULL); +-#else +- iproute_del(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0); +-#endif + } + } + +diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c +index 6c61fc2..60eca8b 100644 +--- a/accel-pppd/libnetlink/iputils.c ++++ b/accel-pppd/libnetlink/iputils.c +@@ -533,11 +533,7 @@ out: + } + #endif + +-#ifdef HAVE_VRF + int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name) +-#else +-int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio) +-#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -586,11 +582,7 @@ int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + return r; + } + +-#ifdef HAVE_VRF + int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name) +-#else +-int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio) +-#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -633,11 +625,7 @@ int __export iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + return r; + } + +-#ifdef HAVE_VRF + int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name) +-#else +-int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio) +-#endif + { + struct ipaddr_req { + struct nlmsghdr n; +@@ -684,11 +672,7 @@ int __export ip6route_add(int ifindex, const struct in6_addr *dst, int pref_len, + return r; + } + +-#ifdef HAVE_VRF + int __export ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio, const char *vrf_name) +-#else +-int __export ip6route_del(int ifindex, const struct in6_addr *dst, int pref_len, const struct in6_addr *gw, int proto, uint32_t prio) +-#endif + { + struct ipaddr_req { + struct nlmsghdr n; +diff --git a/accel-pppd/libnetlink/iputils.h b/accel-pppd/libnetlink/iputils.h +index c3063f4..d3a93f4 100644 +--- a/accel-pppd/libnetlink/iputils.h ++++ b/accel-pppd/libnetlink/iputils.h +@@ -21,13 +21,8 @@ int ipaddr_add_peer(int ifindex, in_addr_t addr, in_addr_t peer_addr); + int ipaddr_del(int ifindex, in_addr_t addr, int mask); + int ipaddr_del_peer(int ifindex, in_addr_t addr, in_addr_t peer); + +-#ifdef HAVE_VRF + int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name); + int iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio, const char *vrf_name); +-#else +-int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio); +-int iproute_del(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask, uint32_t prio); +-#endif + in_addr_t iproute_get(in_addr_t dst, in_addr_t *gw); + + #ifdef HAVE_VRF +diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c +index a45666f..9d567b7 100644 +--- a/accel-pppd/radius/radius.c ++++ b/accel-pppd/radius/radius.c +@@ -643,11 +643,7 @@ static void ses_started(struct ap_session *ses) + char nbuf[INET6_ADDRSTRLEN]; + char gwbuf[INET6_ADDRSTRLEN]; + +-#ifdef HAVE_VRF + if (ip6route_add(gw_spec ? 0 : rpd->ses->ifindex, &fr6->prefix, fr6->plen, gw_spec ? &fr6->gw : NULL, 3, fr6->prio, rpd->ses->vrf_name)) { +-#else +- if (ip6route_add(gw_spec ? 0 : rpd->ses->ifindex, &fr6->prefix, fr6->plen, gw_spec ? &fr6->gw : NULL, 3, fr6->prio)) { +-#endif + log_ppp_warn("radius: failed to add route %s/%hhu %s %u\n", + u_ip6str(&fr6->prefix, nbuf), fr6->plen, + u_ip6str(&fr6->gw, gwbuf), fr6->prio); +@@ -655,11 +651,7 @@ static void ses_started(struct ap_session *ses) + } + + for (fr = rpd->fr; fr; fr = fr->next) { +-#ifdef HAVE_VRF + if (iproute_add(fr->gw ? 0 : rpd->ses->ifindex, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio, rpd->ses->vrf_name)) { +-#else +- if (iproute_add(fr->gw ? 0 : rpd->ses->ifindex, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio)) { +-#endif + char dst[17], gw[17]; + u_inet_ntoa(fr->dst, dst); + u_inet_ntoa(fr->gw, gw); +@@ -698,20 +690,12 @@ static void ses_finishing(struct ap_session *ses) + * when the interface is removed. + */ + if (!IN6_IS_ADDR_UNSPECIFIED(&fr6->gw)) +-#ifdef HAVE_VRF + ip6route_del(0, &fr6->prefix, fr6->plen, &fr6->gw, 3, fr6->prio, rpd->ses->vrf_name); +-#else +- ip6route_del(0, &fr6->prefix, fr6->plen, &fr6->gw, 3, fr6->prio); +-#endif + } + + for (fr = rpd->fr; fr; fr = fr->next) { + if (fr->gw) +-#ifdef HAVE_VRF + iproute_del(0, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio, rpd->ses->vrf_name); +-#else +- iproute_del(0, 0, fr->dst, fr->gw, 3, fr->mask, fr->prio); +-#endif + } + + if (rpd->acct_started || rpd->acct_req) +diff --git a/accel-pppd/session.c b/accel-pppd/session.c +index c01417f..fedb6f5 100644 +--- a/accel-pppd/session.c ++++ b/accel-pppd/session.c +@@ -68,6 +68,7 @@ void __export ap_session_init(struct ap_session *ses) + ses->ifindex = -1; + ses->unit_idx = -1; + ses->net = net; ++ ses->vrf_name = NULL; + } + + void __export ap_session_set_ifindex(struct ap_session *ses) +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/accel-ppp/0004-Fix-whitespace-in-accel-pppd-libnetlink-iputils.c.patch b/scripts/package-build/linux-kernel/patches/accel-ppp/0004-Fix-whitespace-in-accel-pppd-libnetlink-iputils.c.patch new file mode 100644 index 00000000..9273c8a3 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/accel-ppp/0004-Fix-whitespace-in-accel-pppd-libnetlink-iputils.c.patch @@ -0,0 +1,26 @@ +From a959ab0c0d659a8b314b98bb577a79ec9ed3542c Mon Sep 17 00:00:00 2001 +From: Chris Hills <chris@brsk.co.uk> +Date: Tue, 11 Jul 2023 10:14:52 +0100 +Subject: [PATCH 4/4] Fix whitespace in accel-pppd/libnetlink/iputils.c + +(cherry picked from commit 10d2fba58928dcb4604a04169cbb3a8c9e8a172f) +--- + accel-pppd/libnetlink/iputils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c +index 60eca8b..afe2380 100644 +--- a/accel-pppd/libnetlink/iputils.c ++++ b/accel-pppd/libnetlink/iputils.c +@@ -551,7 +551,7 @@ int __export iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw + #ifdef HAVE_VRF + __u32 rt_table = ipvrf_get_table(vrf_name); + #else +- __u32 rt_table = RT_TABLE_MAIN; ++ __u32 rt_table = RT_TABLE_MAIN; + #endif + + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/ixgbe/0001-ixgbe-always-enable-support-for-unsupported-SFP-modu.patch b/scripts/package-build/linux-kernel/patches/ixgbe/0001-ixgbe-always-enable-support-for-unsupported-SFP-modu.patch new file mode 100644 index 00000000..3f2cbb4f --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/ixgbe/0001-ixgbe-always-enable-support-for-unsupported-SFP-modu.patch @@ -0,0 +1,48 @@ +From a3ebb453f4a8c95fe3674d09646edb93946d450a Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sat, 15 Feb 2025 09:17:10 +0100 +Subject: [PATCH] ixgbe: always enable support for unsupported SFP+ modules + +--- + src/ixgbe_param.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/ixgbe_param.c b/src/ixgbe_param.c +index bba03ae..3f29492 100644 +--- a/src/ixgbe_param.c ++++ b/src/ixgbe_param.c +@@ -307,7 +307,7 @@ IXGBE_PARAM(LRO, "Large Receive Offload (0,1), default 0 = off"); + * Default Value: 0 + */ + IXGBE_PARAM(allow_unsupported_sfp, "Allow unsupported and untested " +- "SFP+ modules on 82599 based adapters, default 0 = Disable"); ++ "SFP+ modules on 82599 based adapters, default 1 = Enable"); + + /* Enable/disable support for DMA coalescing + * +@@ -1135,8 +1135,8 @@ void ixgbe_check_options(struct ixgbe_adapter *adapter) + struct ixgbe_option opt = { + .type = enable_option, + .name = "allow_unsupported_sfp", +- .err = "defaulting to Disabled", +- .def = OPTION_DISABLED ++ .err = "defaulting to Enabled", ++ .def = OPTION_ENABLED + }; + #ifdef module_param_array + if (num_allow_unsupported_sfp > bd) { +@@ -1152,7 +1152,11 @@ void ixgbe_check_options(struct ixgbe_adapter *adapter) + } + #ifdef module_param_array + } else { ++ if (opt.def == OPTION_ENABLED) { ++ adapter->hw.allow_unsupported_sfp = true; ++ } else { + adapter->hw.allow_unsupported_sfp = false; ++ } + } + #endif + } +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/ixgbe/0002-BACKPORT-linux-v6.9-PATCH-ixgbe-Add-1000BASE-BX-supp.patch b/scripts/package-build/linux-kernel/patches/ixgbe/0002-BACKPORT-linux-v6.9-PATCH-ixgbe-Add-1000BASE-BX-supp.patch new file mode 100644 index 00000000..924c248b --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/ixgbe/0002-BACKPORT-linux-v6.9-PATCH-ixgbe-Add-1000BASE-BX-supp.patch @@ -0,0 +1,259 @@ +From 0ef6088d0d93fcda7adee59fe675f96bcae36c13 Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sat, 15 Feb 2025 09:17:35 +0100 +Subject: [PATCH] [BACKPORT linux v6.9] [PATCH] ixgbe: Add 1000BASE-BX support + +Added support for 1000BASE-BX, i.e. Gigabit Ethernet over single strand +of single-mode fiber. +The initialization of a 1000BASE-BX SFP is the same as 1000BASE-SX/LX +with the only difference that the Bit Rate Nominal Value must be +checked to make sure it is a Gigabit Ethernet transceiver, as described +by the SFF-8472 specification. + +This was tested with the FS.com SFP-GE-BX 1310/1490nm 10km transceiver: +$ ethtool -m eth4 + Identifier : 0x03 (SFP) + Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID) + Connector : 0x07 (LC) + Transceiver codes : 0x00 0x00 0x00 0x40 0x00 0x00 0x00 0x00 0x00 + Transceiver type : Ethernet: BASE-BX10 + Encoding : 0x01 (8B/10B) + BR, Nominal : 1300MBd + Rate identifier : 0x00 (unspecified) + Length (SMF,km) : 10km + Length (SMF) : 10000m + Length (50um) : 0m + Length (62.5um) : 0m + Length (Copper) : 0m + Length (OM3) : 0m + Laser wavelength : 1310nm + Vendor name : FS + Vendor OUI : 64:9d:99 + Vendor PN : SFP-GE-BX + Vendor rev : + Option values : 0x20 0x0a + Option : RX_LOS implemented + Option : TX_FAULT implemented + Option : Power level 3 requirement + BR margin, max : 0% + BR margin, min : 0% + Vendor SN : S2202359108 + Date code : 220307 + Optical diagnostics support : Yes + Laser bias current : 17.650 mA + Laser output power : 0.2132 mW / -6.71 dBm + Receiver signal average optical power : 0.2740 mW / -5.62 dBm + Module temperature : 47.30 degrees C / 117.13 degrees F + Module voltage : 3.2576 V + Alarm/warning flags implemented : Yes + Laser bias current high alarm : Off + Laser bias current low alarm : Off + Laser bias current high warning : Off + Laser bias current low warning : Off + Laser output power high alarm : Off + Laser output power low alarm : Off + Laser output power high warning : Off + Laser output power low warning : Off + Module temperature high alarm : Off + Module temperature low alarm : Off + Module temperature high warning : Off + Module temperature low warning : Off + Module voltage high alarm : Off + Module voltage low alarm : Off + Module voltage high warning : Off + Module voltage low warning : Off + Laser rx power high alarm : Off + Laser rx power low alarm : Off + Laser rx power high warning : Off + Laser rx power low warning : Off + Laser bias current high alarm threshold : 110.000 mA + Laser bias current low alarm threshold : 1.000 mA + Laser bias current high warning threshold : 100.000 mA + Laser bias current low warning threshold : 1.000 mA + Laser output power high alarm threshold : 0.7079 mW / -1.50 dBm + Laser output power low alarm threshold : 0.0891 mW / -10.50 dBm + Laser output power high warning threshold : 0.6310 mW / -2.00 dBm + Laser output power low warning threshold : 0.1000 mW / -10.00 dBm + Module temperature high alarm threshold : 90.00 degrees C / 194.00 degrees F + Module temperature low alarm threshold : -45.00 degrees C / -49.00 degrees F + Module temperature high warning threshold : 85.00 degrees C / 185.00 degrees F + Module temperature low warning threshold : -40.00 degrees C / -40.00 degrees F + Module voltage high alarm threshold : 3.7950 V + Module voltage low alarm threshold : 2.8050 V + Module voltage high warning threshold : 3.4650 V + Module voltage low warning threshold : 3.1350 V + Laser rx power high alarm threshold : 0.7079 mW / -1.50 dBm + Laser rx power low alarm threshold : 0.0028 mW / -25.53 dBm + Laser rx power high warning threshold : 0.6310 mW / -2.00 dBm + Laser rx power low warning threshold : 0.0032 mW / -24.95 dBm + +Signed-off-by: Ernesto Castellotti <ernesto@castellotti.net> +Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> +Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> +Link: https://lore.kernel.org/r/20240301184806.2634508-3-anthony.l.nguyen@intel.com +Signed-off-by: Jakub Kicinski <kuba@kernel.org> +--- + src/ixgbe_82599.c | 4 +++- + src/ixgbe_ethtool.c | 4 ++++ + src/ixgbe_phy.c | 33 +++++++++++++++++++++++++++++---- + src/ixgbe_phy.h | 2 ++ + src/ixgbe_type.h | 2 ++ + 5 files changed, 40 insertions(+), 5 deletions(-) + +diff --git a/src/ixgbe_82599.c b/src/ixgbe_82599.c +index c95fc4f..a5c74df 100644 +--- a/src/ixgbe_82599.c ++++ b/src/ixgbe_82599.c +@@ -395,7 +395,9 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || +- hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1) { + *speed = IXGBE_LINK_SPEED_1GB_FULL; + *autoneg = true; + goto out; +diff --git a/src/ixgbe_ethtool.c b/src/ixgbe_ethtool.c +index e983035..7dc9343 100644 +--- a/src/ixgbe_ethtool.c ++++ b/src/ixgbe_ethtool.c +@@ -412,6 +412,8 @@ static int ixgbe_get_link_ksettings(struct net_device *netdev, + case ixgbe_sfp_type_1g_sx_core1: + case ixgbe_sfp_type_1g_lx_core0: + case ixgbe_sfp_type_1g_lx_core1: ++ case ixgbe_sfp_type_1g_bx_core0: ++ case ixgbe_sfp_type_1g_bx_core1: + ethtool_link_ksettings_add_link_mode(cmd, supported, + FIBRE); + ethtool_link_ksettings_add_link_mode(cmd, advertising, +@@ -642,6 +644,8 @@ static int ixgbe_get_settings(struct net_device *netdev, + case ixgbe_sfp_type_1g_sx_core1: + case ixgbe_sfp_type_1g_lx_core0: + case ixgbe_sfp_type_1g_lx_core1: ++ case ixgbe_sfp_type_1g_bx_core0: ++ case ixgbe_sfp_type_1g_bx_core1: + ecmd->supported |= SUPPORTED_FIBRE; + ecmd->advertising |= ADVERTISED_FIBRE; + ecmd->port = PORT_FIBRE; +diff --git a/src/ixgbe_phy.c b/src/ixgbe_phy.c +index 3d99a88..3632234 100644 +--- a/src/ixgbe_phy.c ++++ b/src/ixgbe_phy.c +@@ -1268,6 +1268,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) + u8 comp_codes_1g = 0; + u8 comp_codes_10g = 0; + u8 oui_bytes[3] = {0, 0, 0}; ++ u8 bitrate_nominal = 0; + u8 cable_tech = 0; + u8 cable_spec = 0; + u16 enforce_sfp = 0; +@@ -1311,6 +1312,12 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) + IXGBE_SFF_CABLE_TECHNOLOGY, + &cable_tech); + ++ if (status != IXGBE_SUCCESS) ++ goto err_read_i2c_eeprom; ++ ++ status = hw->phy.ops.read_i2c_eeprom(hw, ++ IXGBE_SFF_BITRATE_NOMINAL, ++ &bitrate_nominal); + if (status != IXGBE_SUCCESS) + goto err_read_i2c_eeprom; + +@@ -1393,6 +1400,18 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) + else + hw->phy.sfp_type = + ixgbe_sfp_type_1g_lx_core1; ++ /* Support only Ethernet 1000BASE-BX10, checking the Bit Rate ++ * Nominal Value as per SFF-8472 by convention 1.25 Gb/s should ++ * be rounded up to 0Dh (13 in units of 100 MBd) for 1000BASE-BX ++ */ ++ } else if ((comp_codes_1g & IXGBE_SFF_BASEBX10_CAPABLE) && ++ (bitrate_nominal == 0xD)) { ++ if (hw->bus.lan_id == 0) ++ hw->phy.sfp_type = ++ ixgbe_sfp_type_1g_bx_core0; ++ else ++ hw->phy.sfp_type = ++ ixgbe_sfp_type_1g_bx_core1; + } else { + hw->phy.sfp_type = ixgbe_sfp_type_unknown; + } +@@ -1483,7 +1502,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || +- hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1)) { + hw->phy.type = ixgbe_phy_sfp_unsupported; + status = IXGBE_ERR_SFP_NOT_SUPPORTED; + goto out; +@@ -1502,7 +1523,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || + hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || +- hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1)) { + /* Make sure we're a supported PHY type */ + if (hw->phy.type == ixgbe_phy_sfp_intel) { + status = IXGBE_SUCCESS; +@@ -1821,12 +1844,14 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, + if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 || + sfp_type == ixgbe_sfp_type_1g_lx_core0 || + sfp_type == ixgbe_sfp_type_1g_cu_core0 || +- sfp_type == ixgbe_sfp_type_1g_sx_core0) ++ sfp_type == ixgbe_sfp_type_1g_sx_core0 || ++ sfp_type == ixgbe_sfp_type_1g_bx_core0) + sfp_type = ixgbe_sfp_type_srlr_core0; + else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 || + sfp_type == ixgbe_sfp_type_1g_lx_core1 || + sfp_type == ixgbe_sfp_type_1g_cu_core1 || +- sfp_type == ixgbe_sfp_type_1g_sx_core1) ++ sfp_type == ixgbe_sfp_type_1g_sx_core1 || ++ sfp_type == ixgbe_sfp_type_1g_bx_core1) + sfp_type = ixgbe_sfp_type_srlr_core1; + + /* Read offset to PHY init contents */ +diff --git a/src/ixgbe_phy.h b/src/ixgbe_phy.h +index b6ddb2e..29c4645 100644 +--- a/src/ixgbe_phy.h ++++ b/src/ixgbe_phy.h +@@ -18,6 +18,7 @@ + #define IXGBE_SFF_1GBE_COMP_CODES 0x6 + #define IXGBE_SFF_10GBE_COMP_CODES 0x3 + #define IXGBE_SFF_CABLE_TECHNOLOGY 0x8 ++#define IXGBE_SFF_BITRATE_NOMINAL 0xC + #define IXGBE_SFF_CABLE_SPEC_COMP 0x3C + #define IXGBE_SFF_SFF_8472_SWAP 0x5C + #define IXGBE_SFF_SFF_8472_COMP 0x5E +@@ -40,6 +41,7 @@ + #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 + #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 + #define IXGBE_SFF_1GBASET_CAPABLE 0x8 ++#define IXGBE_SFF_BASEBX10_CAPABLE 0x64 + #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 + #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 + #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 +diff --git a/src/ixgbe_type.h b/src/ixgbe_type.h +index 1700599..403687c 100644 +--- a/src/ixgbe_type.h ++++ b/src/ixgbe_type.h +@@ -3722,6 +3722,8 @@ enum ixgbe_sfp_type { + ixgbe_sfp_type_1g_sx_core1 = 12, + ixgbe_sfp_type_1g_lx_core0 = 13, + ixgbe_sfp_type_1g_lx_core1 = 14, ++ ixgbe_sfp_type_1g_bx_core0 = 15, ++ ixgbe_sfp_type_1g_bx_core1 = 16, + ixgbe_sfp_type_not_present = 0xFFFE, + ixgbe_sfp_type_unknown = 0xFFFF + }; +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch b/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch new file mode 100644 index 00000000..107fdc67 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch @@ -0,0 +1,159 @@ +From 81d38c4a32e059ad7835f7dc254e7627642afbe9 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger <stephen@networkplumber.org> +Date: Mon, 29 Apr 2013 18:50:15 -0700 +Subject: [PATCH] VyOS: Add linkstate IP device attribute + +Backport of earlier Vyatta patch. + +(cherry picked from commit 7c5a851086686be14ae937c80d6cee34814dbefc) + +--- + Documentation/networking/ip-sysctl.rst | 11 +++++++++++ + include/linux/inetdevice.h | 1 + + include/linux/ipv6.h | 1 + + include/uapi/linux/ip.h | 1 + + include/uapi/linux/ipv6.h | 1 + + net/ipv4/devinet.c | 1 + + net/ipv6/addrconf.c | 8 ++++++++ + net/ipv6/route.c | 10 ++++++++++ + 8 files changed, 34 insertions(+) + +diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst +index a66054d0763a..53440098fa98 100644 +--- a/Documentation/networking/ip-sysctl.rst ++++ b/Documentation/networking/ip-sysctl.rst +@@ -1734,6 +1734,17 @@ src_valid_mark - BOOLEAN + + Default value is 0. + ++link_filter - INTEGER ++ 0 - Allow packets to be received for the address on this interface ++ even if interface is disabled or no carrier. ++ 1 - Ignore packets received if interface associated with the incoming ++ address is down. ++ 2 - Ignore packets received if interface associated with the incoming ++ address is down or has no carrier. ++ ++ Default value is 0. Note that some distributions enable it ++ in startup scripts. ++ + arp_filter - BOOLEAN + - 1 - Allows you to have multiple network interfaces on the same + subnet, and have the ARPs for each interface be answered +diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h +index ddb27fc0ee8c..8ee3191d9558 100644 +--- a/include/linux/inetdevice.h ++++ b/include/linux/inetdevice.h +@@ -137,6 +137,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) + #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) + #define IN_DEV_ARP_EVICT_NOCARRIER(in_dev) IN_DEV_ANDCONF((in_dev), \ + ARP_EVICT_NOCARRIER) ++#define IN_DEV_LINKFILTER(in_dev) IN_DEV_MAXCONF((in_dev), LINKFILTER) + + struct in_ifaddr { + struct hlist_node hash; +diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h +index af8a771a053c..ece8ac89d317 100644 +--- a/include/linux/ipv6.h ++++ b/include/linux/ipv6.h +@@ -84,6 +84,7 @@ struct ipv6_devconf { + __u8 ndisc_evict_nocarrier; + + struct ctl_table_header *sysctl_header; ++ __s32 link_filter; + }; + + struct ipv6_params { +diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h +index 283dec7e3645..8067941a635e 100644 +--- a/include/uapi/linux/ip.h ++++ b/include/uapi/linux/ip.h +@@ -173,6 +173,7 @@ enum + IPV4_DEVCONF_DROP_GRATUITOUS_ARP, + IPV4_DEVCONF_BC_FORWARDING, + IPV4_DEVCONF_ARP_EVICT_NOCARRIER, ++ IPV4_DEVCONF_LINKFILTER, + __IPV4_DEVCONF_MAX + }; + +diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h +index cf592d7b630f..e8915701aa73 100644 +--- a/include/uapi/linux/ipv6.h ++++ b/include/uapi/linux/ipv6.h +@@ -199,6 +199,7 @@ enum { + DEVCONF_NDISC_EVICT_NOCARRIER, + DEVCONF_ACCEPT_UNTRACKED_NA, + DEVCONF_ACCEPT_RA_MIN_LFT, ++ DEVCONF_LINK_FILTER, + DEVCONF_MAX + }; + +diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c +index c33b1ecc591e..7576d51cd16d 100644 +--- a/net/ipv4/devinet.c ++++ b/net/ipv4/devinet.c +@@ -2609,6 +2609,7 @@ static struct devinet_sysctl_table { + "route_localnet"), + DEVINET_SYSCTL_FLUSHING_ENTRY(DROP_UNICAST_IN_L2_MULTICAST, + "drop_unicast_in_l2_multicast"), ++ DEVINET_SYSCTL_RW_ENTRY(LINKFILTER, "link_filter"), + }, + }; + +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c +index bb9add46e382..20346b1dd103 100644 +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -5674,6 +5674,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, + array[DEVCONF_NDISC_EVICT_NOCARRIER] = cnf->ndisc_evict_nocarrier; + array[DEVCONF_ACCEPT_UNTRACKED_NA] = cnf->accept_untracked_na; + array[DEVCONF_ACCEPT_RA_MIN_LFT] = cnf->accept_ra_min_lft; ++ array[DEVCONF_LINK_FILTER] = cnf->link_filter; + } + + static inline size_t inet6_ifla6_size(void) +@@ -7116,6 +7117,13 @@ static const struct ctl_table addrconf_sysctl[] = { + .extra1 = (void *)SYSCTL_ZERO, + .extra2 = (void *)SYSCTL_ONE, + }, ++ { ++ .procname = "link_filter", ++ .data = &ipv6_devconf.link_filter, ++ .maxlen = sizeof(int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, ++ }, + { + .procname = "ioam6_id", + .data = &ipv6_devconf.ioam6_id, +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index 53197087353a..4fed0253cf83 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -716,6 +716,14 @@ static inline void rt6_probe(struct fib6_nh *fib6_nh) + } + #endif + ++static inline int rt6_link_filter(const struct fib6_nh *nh) ++{ ++ const struct net_device *dev = nh->fib_nh_dev; ++ int linkf = __in6_dev_get(dev)->cnf.link_filter; ++ return (linkf && !netif_running(dev)) ++ || (linkf > 1 && !netif_carrier_ok(dev)); ++} ++ + /* + * Default Router Selection (RFC 2461 6.3.6) + */ +@@ -757,6 +765,8 @@ static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif, + + if (!m && (strict & RT6_LOOKUP_F_IFACE)) + return RT6_NUD_FAIL_HARD; ++ if (rt6_link_filter(nh)) ++ return -1; + #ifdef CONFIG_IPV6_ROUTER_PREF + m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(fib6_flags)) << 2; + #endif +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch b/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch new file mode 100644 index 00000000..115f6831 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/kernel/0002-inotify-support-for-stackable-filesystems.patch @@ -0,0 +1,299 @@ +From 1d625d2f745b61a718ce52cd1729f467c17defa6 Mon Sep 17 00:00:00 2001 +From: Alex Harpin <development@landsofshadow.co.uk> +Date: Wed, 31 Dec 2014 10:33:38 +0000 +Subject: [PATCH] VyOS: add inotify support for stackable filesystems + (overlayfs) + +As it stands at the moment, overlayfs doesn't have full support for +inotify, and as such anything that relies on inotify currently has +issues. The simplest method of demonstrating this is to tail a file +(so tail -f /var/log/messages) and see that it doesn't follow changes +in that file. This has been reported in a number of places, including +Bug #882147 in Ubuntu. This patch is based on the version proposed by +Li Jianguo in response to this bug, adding support for inotify in +stackable filesystems. + +This commit provides a complete fix for the workaround implemented +for bug #303, and will allow that commit to be reverted. + +Bug #425 http://bugzilla.vyos.net/show_bug.cgi?id=425 + +(cherry picked from commit a93f1128bc83b5a6628da242e71c18ef05e81ea2) + +--- + fs/notify/inotify/Kconfig | 9 +++ + fs/notify/inotify/inotify_user.c | 114 ++++++++++++++++++++++++++++++- + fs/overlayfs/super.c | 27 ++++++-- + include/linux/inotify.h | 28 ++++++++ + 4 files changed, 172 insertions(+), 6 deletions(-) + +diff --git a/fs/notify/inotify/Kconfig b/fs/notify/inotify/Kconfig +index 1cc8be25df7e..bc4acd1a6ea4 100644 +--- a/fs/notify/inotify/Kconfig ++++ b/fs/notify/inotify/Kconfig +@@ -15,3 +15,12 @@ config INOTIFY_USER + For more information, see <file:Documentation/filesystems/inotify.rst> + + If unsure, say Y. ++ ++config INOTIFY_STACKFS ++ bool "Inotify support for stackable filesystem" ++ select INOTIFY_USER ++ default y ++ help ++ Say Y here to enable inotify support for stackable filesystem. ++ ++ If unsure, say N. +diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c +index 1c4bfdab008d..cf567cc33679 100644 +--- a/fs/notify/inotify/inotify_user.c ++++ b/fs/notify/inotify/inotify_user.c +@@ -15,6 +15,7 @@ + + #include <linux/file.h> + #include <linux/fs.h> /* struct inode */ ++#include <linux/mount.h> + #include <linux/fsnotify_backend.h> + #include <linux/idr.h> + #include <linux/init.h> /* fs_initcall */ +@@ -97,6 +98,93 @@ static void __init inotify_sysctls_init(void) + #define inotify_sysctls_init() do { } while (0) + #endif /* CONFIG_SYSCTL */ + ++#ifdef CONFIG_INOTIFY_STACKFS ++ ++static DEFINE_RWLOCK(inotify_fs_lock); ++static LIST_HEAD(inotify_fs_list); ++ ++static inline struct file_system_type* peek_fs_type(struct path *path) ++{ ++ return path->mnt->mnt_sb->s_type; ++} ++ ++static struct inotify_stackfs* inotify_get_stackfs(struct path *path) ++{ ++ struct file_system_type *fs; ++ struct inotify_stackfs *fse, *ret = NULL; ++ ++ fs = peek_fs_type(path); ++ ++ read_lock(&inotify_fs_lock); ++ list_for_each_entry(fse, &inotify_fs_list, list) { ++ if (fse->fs_type == fs) { ++ ret = fse; ++ break; ++ } ++ } ++ read_unlock(&inotify_fs_lock); ++ ++ return ret; ++} ++ ++static inline void inotify_put_stackfs(struct inotify_stackfs *fs) ++{ ++} ++ ++int inotify_register_stackfs(struct inotify_stackfs *fs) ++{ ++ int ret = 0; ++ struct inotify_stackfs *fse; ++ ++ BUG_ON(IS_ERR_OR_NULL(fs->fs_type)); ++ BUG_ON(IS_ERR_OR_NULL(fs->func)); ++ ++ INIT_LIST_HEAD(&fs->list); ++ ++ write_lock(&inotify_fs_lock); ++ list_for_each_entry(fse, &inotify_fs_list, list) { ++ if (fse->fs_type == fs->fs_type) { ++ write_unlock(&inotify_fs_lock); ++ ret = -EBUSY; ++ goto out; ++ } ++ } ++ list_add_tail(&fs->list, &inotify_fs_list); ++ write_unlock(&inotify_fs_lock); ++ ++out: ++ return ret; ++} ++EXPORT_SYMBOL_GPL(inotify_register_stackfs); ++ ++void inotify_unregister_stackfs(struct inotify_stackfs *fs) ++{ ++ struct inotify_stackfs *fse, *n; ++ ++ write_lock(&inotify_fs_lock); ++ list_for_each_entry_safe(fse, n, &inotify_fs_list, list) { ++ if (fse == fs) { ++ list_del(&fse->list); ++ break; ++ } ++ } ++ write_unlock(&inotify_fs_lock); ++} ++EXPORT_SYMBOL_GPL(inotify_unregister_stackfs); ++ ++#else ++ ++static inline struct inotify_stackfs* inotify_get_stackfs(struct path *path) ++{ ++ return NULL; ++} ++ ++static inline void inotify_put_stackfs(struct inotify_stackfs *fs) ++{ ++} ++ ++#endif /* CONFIG_INOTIFY_STACKFS */ ++ + static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg) + { + __u32 mask; +@@ -370,8 +458,8 @@ static const struct file_operations inotify_fops = { + /* + * find_inode - resolve a user-given path to a specific inode + */ +-static int inotify_find_inode(const char __user *dirname, struct path *path, +- unsigned int flags, __u64 mask) ++static inline int __inotify_find_inode(const char __user *dirname, struct path *path, ++ unsigned int flags, __u64 mask) + { + int error; + +@@ -392,6 +480,28 @@ static int inotify_find_inode(const char __user *dirname, struct path *path, + return error; + } + ++static int inotify_find_inode(const char __user *dirname, struct path *path, ++ unsigned int flags, __u64 mask) ++{ ++ int ret; ++ struct path tpath; ++ struct inotify_stackfs *fse; ++ ++ ret = __inotify_find_inode(dirname, &tpath, flags, mask); ++ if (ret) ++ return ret; ++ fse = inotify_get_stackfs(&tpath); ++ if (fse == NULL) { ++ *path = tpath; ++ return 0; ++ } ++ ret = fse->func(path, &tpath); ++ inotify_put_stackfs(fse); ++ path_put(&tpath); ++ ++ return ret; ++} ++ + static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, + struct inotify_inode_mark *i_mark) + { +diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c +index 93ee57bc82ad..5f4f886d011e 100644 +--- a/fs/overlayfs/super.c ++++ b/fs/overlayfs/super.c +@@ -15,6 +15,7 @@ + #include <linux/seq_file.h> + #include <linux/posix_acl_xattr.h> + #include <linux/exportfs.h> ++#include <linux/inotify.h> + #include <linux/file.h> + #include <linux/fs_context.h> + #include <linux/fs_parser.h> +@@ -1533,6 +1534,18 @@ static void ovl_inode_init_once(void *foo) + inode_init_once(&oi->vfs_inode); + } + ++static int ovl_inotify_path(struct path *dst, struct path *src) ++{ ++ ovl_path_real(src->dentry, dst); ++ path_get(dst); ++ return 0; ++} ++ ++static struct inotify_stackfs ovl_inotify = { ++ .fs_type = &ovl_fs_type, ++ .func = ovl_inotify_path, ++}; ++ + static int __init ovl_init(void) + { + int err; +@@ -1548,18 +1561,24 @@ static int __init ovl_init(void) + err = ovl_aio_request_cache_init(); + if (!err) { + err = register_filesystem(&ovl_fs_type); +- if (!err) +- return 0; ++ if (err) ++ goto err; ++ err = inotify_register_stackfs(&ovl_inotify); ++ if (err) ++ goto err; ++ return 0; + +- ovl_aio_request_cache_destroy(); + } ++err: + kmem_cache_destroy(ovl_inode_cachep); +- ++ unregister_filesystem(&ovl_fs_type); ++ ovl_aio_request_cache_destroy(); + return err; + } + + static void __exit ovl_exit(void) + { ++ inotify_unregister_stackfs(&ovl_inotify); + unregister_filesystem(&ovl_fs_type); + + /* +diff --git a/include/linux/inotify.h b/include/linux/inotify.h +index 8d20caa1b268..c126e2f93a73 100644 +--- a/include/linux/inotify.h ++++ b/include/linux/inotify.h +@@ -8,6 +8,8 @@ + #define _LINUX_INOTIFY_H + + #include <uapi/linux/inotify.h> ++#include <linux/list.h> ++#include <linux/fs.h> + + #define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ + IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ +@@ -17,4 +19,30 @@ + IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \ + IN_MASK_CREATE | IN_ISDIR | IN_ONESHOT) + ++typedef int (*inotify_path_proc)(struct path *dst, struct path *src); ++ ++struct inotify_stackfs { ++ struct list_head list; /* entry in inotify_fs_list */ ++ struct file_system_type *fs_type; /* registed file_system_type */ ++ inotify_path_proc func; /* registed callback function */ ++}; ++ ++#ifdef CONFIG_INOTIFY_STACKFS ++ ++extern int inotify_register_stackfs(struct inotify_stackfs *fs); ++extern void inotify_unregister_stackfs(struct inotify_stackfs *fs); ++ ++#else ++ ++static inline int inotify_register_stackfs(struct inotify_stackfs *fs) ++{ ++ return 0; ++} ++ ++static inline void inotify_unregister_stackfs(struct inotify_stackfs *fs) ++{ ++} ++ ++#endif /* CONFIG_INOTIFY_STACKFS */ ++ + #endif /* _LINUX_INOTIFY_H */ +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/kernel/build-linux-perf-package.patch b/scripts/package-build/linux-kernel/patches/kernel/build-linux-perf-package.patch new file mode 100644 index 00000000..082ad589 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/kernel/build-linux-perf-package.patch @@ -0,0 +1,62 @@ +diff --git c/scripts/package/builddeb i/scripts/package/builddeb +index d7dd0d04c70c..6f4a9a7c2c62 100755 +--- c/scripts/package/builddeb ++++ i/scripts/package/builddeb +@@ -182,6 +182,16 @@ install_libc_headers () { + mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ + } + ++install_perf () { ++ pdir=$1 ++ ++ rm -rf $pdir ++ ++ $MAKE -C tools/ perf_install prefix=$pdir/usr ++ mv tools/perf/$pdir/usr $srctree/$pdir ++ ++} ++ + rm -f debian/files + + packages_enabled=$(dh_listpackages) +@@ -199,6 +209,8 @@ do + install_libc_headers debian/linux-libc-dev;; + linux-headers-*) + install_kernel_headers debian/linux-headers ${package#linux-headers-};; ++ linux-perf-*) ++ install_perf debian/linux-perf ${package};; + esac + done + +@@ -213,6 +225,8 @@ do + create_package ${package} debian/linux-libc-dev;; + linux-headers-*) + create_package ${package} debian/linux-headers;; ++ linux-perf-*) ++ create_package ${package} debian/linux-perf;; + esac + done + +diff --git c/scripts/package/mkdebian i/scripts/package/mkdebian +index 5044224cf671..21f98ae50be0 100755 +--- c/scripts/package/mkdebian ++++ i/scripts/package/mkdebian +@@ -238,6 +238,18 @@ Description: Linux support headers for userspace development + Multi-Arch: same + EOF + ++cat <<EOF >> debian/control ++ ++Package: linux-perf-$version ++Section: devel ++Architecture: $debarch ++Depends: \${shlibs:Depends} ++Description: Performance analysis tools for Linux $version ++ This package contains the 'perf' performance analysis tools for Linux ++ kernel version $version . ++Multi-Arch: same ++EOF ++ + if is_enabled CONFIG_MODULES; then + cat <<EOF >> debian/control + |