From nobody Sun Oct 02 13:13:01 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MgPXY59sqz4dQ6G; Sun, 2 Oct 2022 13:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MgPXY4lqKz3sb3; Sun, 2 Oct 2022 13:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664716381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m+yh++U3jW9BJTPo7WqarrOJSXK9zQ+xRSB6hxFxIXM=; b=qcfLVqArqLBgGtGScLZjM+aQz36WNE7SejmPYGaftzVURLOk22Jgw8Z6xSGdqNwZEExbk6 mVOnLnG/13XejfoKgxMe/mH/oL9cBsgjCOIYHUHjB9+NwfXJH+zk0guHiusb4E3ONGvsly UofL8AIUgfKUolWXq7BB8wVJMfSi9VDar8Y3EzHpOUKqwKygY/ZJSNzS+1bv0wT+RctSkh 0u2rgpSlqOxSoNr9r6A0qlPVuk7cazroc3jydpidyNp3iiMIdyW/nZWbAKAEddDGk32ald R9AS58F3GI6XHhaLbSOnACu0U9jKCeqAcps4M1QrSUC4B9x/9hrpVr97la9lSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MgPXY3sS0zsLM; Sun, 2 Oct 2022 13:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 292DD1Gi015701; Sun, 2 Oct 2022 13:13:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 292DD1ih015700; Sun, 2 Oct 2022 13:13:01 GMT (envelope-from git) Date: Sun, 2 Oct 2022 13:13:01 GMT Message-Id: <202210021313.292DD1ih015700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 356724fc931f - main - netlink: fix non-default builds (no INET, INET6, ROUTE_MPATH). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 356724fc931f4af1ed992a24f114070b14bb430a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664716381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m+yh++U3jW9BJTPo7WqarrOJSXK9zQ+xRSB6hxFxIXM=; b=OsE38714uzyhU323xh/eIAn2c5Ni3EWLd59xWg32JrmLm7Rq/yOj9Amlyq/f5E3OQuzTJq khgAAzI+lm7IyzuG+wec+9oY3GlpX4iOs6+UmSMEFVp6KOCYX+J1swK/e6XqNMzmBv4VYk A0eHOPX03rX0WpKY+G9wgkvLHshr//hc79iEFzIcaAu0Cbr6oXpP18W5Nnhm8LXYF9FZDv FdqelrpVGNYlUzGQprU/yBaz0IjVuq+U1tjSoApfv4VTFXIUoE9C27L2qvnJogMm/XggeF XZPCpGeeP6AUq25B9hBS9ep0wDugnk5RO0GYFwV7gHg6TQrbqs6r58lCv/aEXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664716381; a=rsa-sha256; cv=none; b=rCzzANo/GoY2jmZES75iLF1cYDhP9KDuBWZQ4bA7QYW+W9TK6+cWqwaxrDGIgka0gcKpt0 r4n9XNZyk0qgAouF9rrAv2igXXbX15vexLbL5VpxutaoJpLpKsmDA1Ff03rLU0ulrqnPSs rOZwh16QdHg6yt/zgOhbVVpbL5OP1DZ4j6eGQaLlqoxPWiP4mEPdgOeAE5DSk+S8UEiWW0 em5id/0KOZbpj4W46T0xBFb2VCuxsQ6KiCFR9yDSKe7tjxV6016z2Hf2WeqwZ+8qRSI6WV 4bbPg+04dzwfOFydsA+imaWAC65/ke4eW3q12ZClyzaah/VV4J3QQaDdMNd4SQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=356724fc931f4af1ed992a24f114070b14bb430a commit 356724fc931f4af1ed992a24f114070b14bb430a Author: Alexander V. Chernikov AuthorDate: 2022-10-02 13:02:24 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-10-02 13:12:52 +0000 netlink: fix non-default builds (no INET, INET6, ROUTE_MPATH). --- sys/netlink/route/neigh.c | 4 ++-- sys/netlink/route/nexthop.c | 8 ++++++-- sys/netlink/route/route.c | 20 +++++++++++++++++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sys/netlink/route/neigh.c b/sys/netlink/route/neigh.c index 73844398d26d..44245e14b6b6 100644 --- a/sys/netlink/route/neigh.c +++ b/sys/netlink/route/neigh.c @@ -344,8 +344,8 @@ rtnl_handle_newneigh(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * int addrlen = attrs.nda_ifp->if_addrlen; if (attrs.nda_lladdr->nla_len != sizeof(struct nlattr) + addrlen) { NLMSG_REPORT_ERR_MSG(npt, - "NDA_LLADDR address length (%ld) is different from expected (%d)", - attrs.nda_lladdr->nla_len - sizeof(struct nlattr), addrlen); + "NDA_LLADDR address length (%d) is different from expected (%d)", + (int)attrs.nda_lladdr->nla_len - (int)sizeof(struct nlattr), addrlen); return (EINVAL); } diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index 77be3a612641..31816d84f189 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_route.h" #include #include #include @@ -268,10 +269,12 @@ nl_find_base_unhop(struct unhop_ctl *ctl, uint32_t uidx) static struct nhop_object * clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_flags) { +#ifdef ROUTE_MPATH const struct weightened_nhop *wn; struct weightened_nhop *wn_new, wn_base[MAX_STACK_NHOPS]; - struct nhop_object *nh = NULL; uint32_t num_nhops; +#endif + struct nhop_object *nh = NULL; int error; if (unhop->un_nhop_src != NULL) { @@ -296,7 +299,7 @@ clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_f nhop_set_pxtype_flag(nh, nh_flags); return (nhop_get_nhop(nh, &error)); } - +#ifdef ROUTE_MPATH wn = unhop->un_nhgrp_src; num_nhops = unhop->un_nhgrp_count; @@ -326,6 +329,7 @@ clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_f if (wn_new != wn_base) free(wn_new, M_TEMP); +#endif return (nh); } diff --git a/sys/netlink/route/route.c b/sys/netlink/route/route.c index 7573b371155e..63489dc8173a 100644 --- a/sys/netlink/route/route.c +++ b/sys/netlink/route/route.c @@ -67,6 +67,7 @@ get_rtm_type(const struct nhop_object *nh) static uint8_t nl_get_rtm_protocol(const struct nhop_object *nh) { +#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { const struct nhgrp_object *nhg = (const struct nhgrp_object *)nh; uint8_t origin = nhgrp_get_origin(nhg); @@ -74,6 +75,7 @@ nl_get_rtm_protocol(const struct nhop_object *nh) return (origin); nh = nhg->nhops[0]; } +#endif uint8_t origin = nhop_get_origin(nh); if (origin != RTPROT_UNSPEC) return (origin); @@ -162,6 +164,7 @@ dump_rc_nhop_mtu(struct nl_writer *nw, const struct nhop_object *nh) *((uint32_t *)(nla + 1)) = nh->nh_mtu; } +#ifdef ROUTE_MPATH static void dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg *rtm) { @@ -201,15 +204,17 @@ dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg * } nlattr_set_len(nw, off); } +#endif static void dump_rc_nhop(struct nl_writer *nw, const struct nhop_object *nh, struct rtmsg *rtm) { +#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { dump_rc_nhg(nw, (const struct nhgrp_object *)nh, rtm); return; } - +#endif uint32_t rtflags = nhop_get_rtflags(nh); /* @@ -279,6 +284,7 @@ dump_px(uint32_t fibnum, const struct nlmsghdr *hdr, int plen = 0; uint32_t scopeid = 0; switch (family) { +#ifdef INET case AF_INET: { struct in_addr addr; @@ -286,6 +292,8 @@ dump_px(uint32_t fibnum, const struct nlmsghdr *hdr, nlattr_add(nw, NL_RTA_DST, 4, &addr); break; } +#endif +#ifdef INET6 case AF_INET6: { struct in6_addr addr; @@ -293,6 +301,7 @@ dump_px(uint32_t fibnum, const struct nlmsghdr *hdr, nlattr_add(nw, NL_RTA_DST, 16, &addr); break; } +#endif default: FIB_LOG(LOG_NOTICE, fibnum, family, "unsupported rt family: %d", family); error = EAFNOSUPPORT; @@ -707,6 +716,7 @@ get_op_flags(int nlm_flags) return (op_flags); } +#ifdef ROUTE_MPATH static int create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh, struct nl_pstate *npt, struct nhop_object **pnh) @@ -729,19 +739,20 @@ create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh, return (error); } +#endif static struct nhop_object * create_nexthop_from_attrs(struct nl_parsed_route *attrs, struct nl_pstate *npt, int *perror) { - struct nhop_object *nh; + struct nhop_object *nh = NULL; int error = 0; if (attrs->rta_multipath != NULL) { +#ifdef ROUTE_MPATH /* Multipath w/o explicit nexthops */ int num_nhops = attrs->rta_multipath->num_nhops; struct weightened_nhop *wn = npt_alloc(npt, sizeof(*wn) * num_nhops); - nh = NULL; for (int i = 0; i < num_nhops; i++) { struct rta_mpath_nh *mpnh = &attrs->rta_multipath->nhops[i]; @@ -763,6 +774,9 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, for (int i = 0; i < num_nhops; i++) nhop_free(wn[i].nh); } +#else + error = ENOTSUP; +#endif *perror = error; } else { nh = nhop_alloc(attrs->rta_table, attrs->rtm_family);