git: b7109c3cfd28 - main - libifconfig: Add missing symbols to map
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b7109c3cfd28559dbb280d640c47ceba192108cc commit b7109c3cfd28559dbb280d640c47ceba192108cc Author: Ryan Moeller AuthorDate: 2021-02-25 18:54:16 + Commit: Ryan Moeller CommitDate: 2021-02-25 18:58:33 + libifconfig: Add missing symbols to map Regenerate the list of generated symbols for libifconfig: ``` grep -hr ^ifconfig_sfp_ /usr/obj/usr/src/amd64.amd64/lib/libifconfig \ | sed 's/(.*/;/' | sort -u ``` Spotted by build failures caused by a missing symbol while working on upgrading libifconfig from internal to private. Reviewed by:markj Differential Revision: https://reviews.freebsd.org/D28927 --- lib/libifconfig/Symbol.map | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index fd147554f085..4f82c8185d0b 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -59,16 +59,24 @@ FBSD_1.6 { ifconfig_sfp_cab_tech_symbol; ifconfig_sfp_conn_description; ifconfig_sfp_conn_symbol; - ifconfig_sfp_eth_10g_description; - ifconfig_sfp_eth_10g_symbol; ifconfig_sfp_eth_1040g_description; ifconfig_sfp_eth_1040g_symbol; + ifconfig_sfp_eth_10g_description; + ifconfig_sfp_eth_10g_symbol; ifconfig_sfp_eth_description; - ifconfig_sfp_eth_symbol; ifconfig_sfp_eth_ext_description; ifconfig_sfp_eth_ext_symbol; + ifconfig_sfp_eth_symbol; + ifconfig_sfp_fc_len_description; + ifconfig_sfp_fc_len_symbol; + ifconfig_sfp_fc_media_description; + ifconfig_sfp_fc_media_symbol; ifconfig_sfp_fc_speed_description; ifconfig_sfp_fc_speed_symbol; + ifconfig_sfp_id_description; + ifconfig_sfp_id_display; + ifconfig_sfp_id_is_qsfp; + ifconfig_sfp_id_symbol; ifconfig_sfp_rev_description; ifconfig_sfp_rev_symbol; }; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 2ae79aa362e7 - main - Install links for zpool feature compat aliases
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=2ae79aa362e7a2ee72657b39be64f1390158aaf6 commit 2ae79aa362e7a2ee72657b39be64f1390158aaf6 Author: Ryan Moeller AuthorDate: 2021-02-25 19:16:09 + Commit: Ryan Moeller CommitDate: 2021-02-25 19:16:09 + Install links for zpool feature compat aliases The alias links were missed when this feature was introduced to the FreeBSD build system in 10f57cb98fd61b2669640a84aa73ad118601f281. Reviewed by:mm MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D28925 --- cddl/share/zfs/compatibility.d/Makefile | 21 + 1 file changed, 21 insertions(+) diff --git a/cddl/share/zfs/compatibility.d/Makefile b/cddl/share/zfs/compatibility.d/Makefile index 6531430ef050..8bc18bcd6391 100644 --- a/cddl/share/zfs/compatibility.d/Makefile +++ b/cddl/share/zfs/compatibility.d/Makefile @@ -25,4 +25,25 @@ FILES= \ FILESDIR= ${SHAREDIR}/zfs/compatibility.d +LINKS= \ + ${FILESDIR}/compat-2018 ${FILESDIR}/2018 \ + ${FILESDIR}/compat-2019 ${FILESDIR}/2019 \ + ${FILESDIR}/compat-2020 ${FILESDIR}/2020 \ + ${FILESDIR}/compat-2021 ${FILESDIR}/2021 \ + ${FILESDIR}/freebsd-11.0${FILESDIR}/freebsd-11.1 \ + ${FILESDIR}/freebsd-11.0${FILESDIR}/freenas-11.0 \ + ${FILESDIR}/freebsd-11.2${FILESDIR}/freenas-11.2 \ + ${FILESDIR}/freebsd-11.3${FILESDIR}/freebsd-11.4 \ + ${FILESDIR}/freebsd-11.3${FILESDIR}/freebsd-12.0 \ + ${FILESDIR}/freebsd-11.3${FILESDIR}/freebsd-12.1 \ + ${FILESDIR}/freebsd-11.3${FILESDIR}/freebsd-12.2 \ + ${FILESDIR}/freebsd-11.3${FILESDIR}/freenas-11.3 \ + ${FILESDIR}/freenas-11.0${FILESDIR}/freenas-11.1 \ + ${FILESDIR}/openzfsonosx-1.9.3 ${FILESDIR}/openzfsonosx-1.9.4 \ + ${FILESDIR}/openzfs-2.0-freebsd ${FILESDIR}/truenas-12.0 \ + ${FILESDIR}/zol-0.7 ${FILESDIR}/ubuntu-18.04 \ + ${FILESDIR}/zol-0.8 ${FILESDIR}/ubuntu-20.04 + +LINKMODE= ${NOBINMODE} + .include ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 1d9ba697f99a - main - libifconfig: Set error in ifconfig_get_groups
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=1d9ba697f99a88b321a7d8b96fa142ea774cd3be commit 1d9ba697f99a88b321a7d8b96fa142ea774cd3be Author: Ryan Moeller AuthorDate: 2021-02-27 08:07:21 + Commit: Ryan Moeller CommitDate: 2021-02-27 23:12:23 + libifconfig: Set error in ifconfig_get_groups This should return -1 with OTHER/ENOMEM set in the handle when malloc fails, like everywhere else in libifconfig. Reviewed by:kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28964 --- lib/libifconfig/libifconfig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c index e67c4e4de04e..1733239132a0 100644 --- a/lib/libifconfig/libifconfig.c +++ b/lib/libifconfig/libifconfig.c @@ -511,7 +511,9 @@ ifconfig_get_groups(ifconfig_handle_t *h, const char *name, len = ifgr->ifgr_len; ifgr->ifgr_groups = (struct ifg_req *)malloc(len); if (ifgr->ifgr_groups == NULL) { - return (1); + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); } bzero(ifgr->ifgr_groups, len); if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: da393346ac47 - main - sbin/ifconfig: Get carp status with libifconfig
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=da393346ac47b22b5f8af4040a59971faadd2c5c commit da393346ac47b22b5f8af4040a59971faadd2c5c Author: Ryan Moeller AuthorDate: 2021-02-26 23:40:58 + Commit: Ryan Moeller CommitDate: 2021-02-28 02:20:38 + sbin/ifconfig: Get carp status with libifconfig A trivial change now that ifconfig is already using libifconfig. Reviewed by:kp (earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28955 --- sbin/ifconfig/carp.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index dcf966d873ee..d6f8d78ba920 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -50,6 +50,8 @@ #include #include +#include + #include "ifconfig.h" static const char *carp_states[] = { CARP_STATES }; @@ -71,16 +73,16 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - int i; + ifconfig_handle_t *lifh; - bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID); - carpr[0].carpr_count = CARP_MAXVHID; - ifr.ifr_data = (caddr_t)&carpr; - - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + lifh = ifconfig_open(); + if (lifh == NULL) return; - for (i = 0; i < carpr[0].carpr_count; i++) { + if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) + goto close; + + for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid, carpr[i].carpr_advbase, carpr[i].carpr_advskew); @@ -89,6 +91,8 @@ carp_status(int s) else printf("\n"); } +close: + ifconfig_close(lifh); } static void ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: a0ebb915045e - main - sbin/ifconfig: Get lagg status with libifconfig
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=a0ebb915045ed0056decec5f001471af4e999f61 commit a0ebb915045ed0056decec5f001471af4e999f61 Author: Ryan Moeller AuthorDate: 2021-02-27 03:05:31 + Commit: Ryan Moeller CommitDate: 2021-02-28 02:20:38 + sbin/ifconfig: Get lagg status with libifconfig Also trimmed an unused block of code that never prints out LAGG_PROTOS. Reviewed by:kp (earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28961 --- sbin/ifconfig/iflagg.c | 144 - 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index 5be8c67cd72a..5e726115662a 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -28,6 +28,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static struct iflaggparam params = { @@ -216,93 +218,87 @@ lacp_format_peer(struct lacp_opreq *req, const char *sep) static void lagg_status(int s) { - struct lagg_protos lpr[] = LAGG_PROTOS; - struct lagg_reqport rpbuf[LAGG_MAX_PORTS]; - struct lagg_reqall ra; - struct lagg_reqopts ro; - struct lagg_reqflags rf; + struct lagg_protos protos[] = LAGG_PROTOS; + ifconfig_handle_t *lifh; + struct ifconfig_lagg_status *lagg; + struct lagg_reqall *ra; + struct lagg_reqflags *rf; + struct lagg_reqopts *ro; + struct lagg_reqport *ports; struct lacp_opreq *lp; - const char *proto = ""; - int i; + const char *proto; - bzero(&ra, sizeof(ra)); - bzero(&ro, sizeof(ro)); + lifh = ifconfig_open(); + if (lifh == NULL) + return; - strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname)); - ra.ra_size = sizeof(rpbuf); - ra.ra_port = rpbuf; + if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) + goto close; - strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname)); - ioctl(s, SIOCGLAGGOPTS, &ro); + ra = lagg->ra; + rf = lagg->rf; + ro = lagg->ro; + ports = ra->ra_port; - strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname)); - if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0) - rf.rf_flags = 0; + proto = ""; + for (size_t i = 0; i < nitems(protos); ++i) { + if (ra->ra_proto == protos[i].lpr_proto) { + proto = protos[i].lpr_name; + break; + } + } + printf("\tlaggproto %s", proto); - if (ioctl(s, SIOCGLAGG, &ra) == 0) { - lp = (struct lacp_opreq *)&ra.ra_lacpreq; + if (rf->rf_flags & LAGG_F_HASHMASK) { + const char *sep = ""; - for (i = 0; i < nitems(lpr); i++) { - if (ra.ra_proto == lpr[i].lpr_proto) { - proto = lpr[i].lpr_name; - break; - } + printf(" lagghash "); + if (rf->rf_flags & LAGG_F_HASHL2) { + printf("%sl2", sep); + sep = ","; } - - printf("\tlaggproto %s", proto); - if (rf.rf_flags & LAGG_F_HASHMASK) { - const char *sep = ""; - - printf(" lagghash "); - if (rf.rf_flags & LAGG_F_HASHL2) { - printf("%sl2", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL3) { - printf("%sl3", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL4) { - printf("%sl4", sep); - sep = ","; - } + if (rf->rf_flags & LAGG_F_HASHL3) { + printf("%sl3", sep); + sep = ","; } - putchar('\n'); - if (verbose) { - printf("\tlagg options:\n"); - printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS); - putchar('\n'); - printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift); - if (ra.ra_proto == LAGG_PROTO_ROUNDROBIN) - printf("\t\trr_limit: %d
git: 9995455218ff - main - sbin/ifconfig: Drop local name var in sfp_status
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=9995455218ff19df9cf0dcaf0198269dc76eeb2d commit 9995455218ff19df9cf0dcaf0198269dc76eeb2d Author: Ryan Moeller AuthorDate: 2021-02-28 02:15:11 + Commit: Ryan Moeller CommitDate: 2021-02-28 02:20:38 + sbin/ifconfig: Drop local name var in sfp_status There is already a globally defined name variable. MFC after: 1 week --- sbin/ifconfig/sfp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c index b7bdc74d42e8..15ff22639060 100644 --- a/sbin/ifconfig/sfp.c +++ b/sbin/ifconfig/sfp.c @@ -62,15 +62,12 @@ sfp_status(int s, struct ifreq *ifr, int verbose) struct ifconfig_sfp_vendor_info vendor_info; struct ifconfig_sfp_status status; ifconfig_handle_t *lifh; - const char *name; size_t channel_count; lifh = ifconfig_open(); if (lifh == NULL) return; - name = ifr->ifr_name; - if (ifconfig_sfp_get_sfp_info(lifh, name, &info) == -1) goto close; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 64bacab177f7 - main - sbin/ifconfig: Get groups with libifconfig
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=64bacab177f7c743af3268a3e1ffcddaf77a68d0 commit 64bacab177f7c743af3268a3e1ffcddaf77a68d0 Author: Ryan Moeller AuthorDate: 2021-02-27 08:17:04 + Commit: Ryan Moeller CommitDate: 2021-02-28 20:38:50 + sbin/ifconfig: Get groups with libifconfig Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28965 --- sbin/ifconfig/ifgroup.c | 38 +++--- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c index 50d17ca6429e..2b13227af4f3 100644 --- a/sbin/ifconfig/ifgroup.c +++ b/sbin/ifconfig/ifgroup.c @@ -43,6 +43,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" /* ARGSUSED */ @@ -84,33 +86,21 @@ unsetifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) static void getifgroups(int s) { - int len, cnt; - struct ifgroupreqifgr; - struct ifg_req *ifg; - - memset(&ifgr, 0, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, name, IFNAMSIZ); + ifconfig_handle_t *lifh; + struct ifgroupreq ifgr; + size_t cnt; - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) { - if (errno == EINVAL || errno == ENOTTY) - return; - else - err(1, "SIOCGIFGROUP"); - } + lifh = ifconfig_open(); + if (lifh == NULL) + return; - len = ifgr.ifgr_len; - ifgr.ifgr_groups = - (struct ifg_req *)calloc(len / sizeof(struct ifg_req), - sizeof(struct ifg_req)); - if (ifgr.ifgr_groups == NULL) - err(1, "getifgroups"); - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) - err(1, "SIOCGIFGROUP"); + if (ifconfig_get_groups(lifh, name, &ifgr) == -1) + goto close; cnt = 0; - ifg = ifgr.ifgr_groups; - for (; ifg && len >= sizeof(struct ifg_req); ifg++) { - len -= sizeof(struct ifg_req); + for (size_t i = 0; i < ifgr.ifgr_len / sizeof(struct ifg_req); ++i) { + struct ifg_req *ifg = &ifgr.ifgr_groups[i]; + if (strcmp(ifg->ifgrq_group, "all")) { if (cnt == 0) printf("\tgroups:"); @@ -122,6 +112,8 @@ getifgroups(int s) printf("\n"); free(ifgr.ifgr_groups); +close: + ifconfig_close(lifh); } static void ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 6f497e47e925 - main - sbin/ifconfig: Get bridge status with libifconfig
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=6f497e47e925f6886f444a8e31e2e939fca264f2 commit 6f497e47e925f6886f444a8e31e2e939fca264f2 Author: Ryan Moeller AuthorDate: 2021-02-26 23:04:38 + Commit: Ryan Moeller CommitDate: 2021-02-28 20:29:23 + sbin/ifconfig: Get bridge status with libifconfig Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28954 --- sbin/ifconfig/ifbridge.c | 169 +++ 1 file changed, 69 insertions(+), 100 deletions(-) diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index f4c51632bc98..cc1520a2e3f0 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -61,6 +61,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static const char *stpstates[] = { STP_STATES }; @@ -116,74 +118,6 @@ do_bridgeflag(int sock, const char *ifs, int flag, int set) err(1, "unable to set bridge flags"); } -static void -bridge_interfaces(int s, const char *prefix) -{ - struct ifbifconf bifc; - struct ifbreq *req; - char *inbuf = NULL, *ninbuf; - char *p, *pad; - int i, len = 8192; - - pad = strdup(prefix); - if (pad == NULL) - err(1, "strdup"); - /* replace the prefix with whitespace */ - for (p = pad; *p != '\0'; p++) { - if(isprint(*p)) - *p = ' '; - } - - for (;;) { - ninbuf = realloc(inbuf, len); - if (ninbuf == NULL) - err(1, "unable to allocate interface buffer"); - bifc.ifbic_len = len; - bifc.ifbic_buf = inbuf = ninbuf; - if (do_cmd(s, BRDGGIFS, &bifc, sizeof(bifc), 0) < 0) - err(1, "unable to get interface list"); - if ((bifc.ifbic_len + sizeof(*req)) < len) - break; - len *= 2; - } - - for (i = 0; i < bifc.ifbic_len / sizeof(*req); i++) { - req = bifc.ifbic_req + i; - printf("%s%s ", prefix, req->ifbr_ifsname); - printb("flags", req->ifbr_ifsflags, IFBIFBITS); - printf("\n"); - - printf("%s", pad); - printf("ifmaxaddr %u", req->ifbr_addrmax); - printf(" port %u priority %u", req->ifbr_portno, - req->ifbr_priority); - printf(" path cost %u", req->ifbr_path_cost); - - if (req->ifbr_ifsflags & IFBIF_STP) { - if (req->ifbr_proto < nitems(stpproto)) - printf(" proto %s", stpproto[req->ifbr_proto]); - else - printf(" ", - req->ifbr_proto); - - printf("\n%s", pad); - if (req->ifbr_role < nitems(stproles)) - printf("role %s", stproles[req->ifbr_role]); - else - printf("", - req->ifbr_role); - if (req->ifbr_state < nitems(stpstates)) - printf(" state %s", stpstates[req->ifbr_state]); - else - printf(" ", - req->ifbr_state); - } - printf("\n"); - } - free(pad); - free(inbuf); -} - static void bridge_addresses(int s, const char *prefix) { @@ -222,44 +156,79 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - struct ifbropreq ifbp; - struct ifbrparam param; - u_int16_t pri; - u_int8_t ht, fd, ma, hc, pro; - u_int8_t lladdr[ETHER_ADDR_LEN]; - u_int16_t bprio; - u_int32_t csize, ctime; + ifconfig_handle_t *lifh; + struct ifconfig_bridge_status *bridge; + struct ifbropreq *params; + const char *pad, *prefix; + uint8_t lladdr[ETHER_ADDR_LEN]; + uint16_t bprio; - if (do_cmd(s, BRDGGCACHE, ¶m, sizeof(param), 0) < 0) - return; - csize = param.ifbrp_csize; - if (do_cmd(s, BRDGGTO, ¶m, sizeof(param), 0) < 0) - return; - ctime = param.ifbrp_ctime; - if (do_cmd(s, BRDGPARAM, &ifbp, sizeof(ifbp), 0) < 0) + lifh = ifconfig_open(); + if (lifh == NULL) return; - pri = ifbp.ifbop_priority; - pro = ifbp.ifbop_protocol; - ht = ifbp.ifbop_hell
git: b12a960e4274 - main - libifconfig: Add a function to get down reason
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b12a960e4274926171dc7a4f9887a0d0a5195b44 commit b12a960e4274926171dc7a4f9887a0d0a5195b44 Author: Ryan Moeller AuthorDate: 2021-02-28 09:34:30 + Commit: Ryan Moeller CommitDate: 2021-02-28 21:43:54 + libifconfig: Add a function to get down reason For use in ifconfig. Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28991 --- lib/libifconfig/Symbol.map | 1 + lib/libifconfig/libifconfig.h | 9 + lib/libifconfig/libifconfig_media.c | 10 ++ 3 files changed, 20 insertions(+) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index 4f82c8185d0b..b3e81d6ee497 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -31,6 +31,7 @@ FBSD_1.6 { ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; + ifconfig_media_get_downreason; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 46a13ae27d69..d8245ea13b23 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -207,6 +207,15 @@ const char *ifconfig_media_get_subtype(int ifmw); const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); +/** Retrieve the reason the interface is down + * @param hAn open ifconfig state object + * @param name The interface name + * @param ifdr Return argument. + * @return 0 on success, nonzero on failure + */ +int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, +struct ifdownreason *ifdr); + int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, struct carpreq *carpr, int ncarpr); diff --git a/lib/libifconfig/libifconfig_media.c b/lib/libifconfig/libifconfig_media.c index f7302d8a9b24..d7ef507604be 100644 --- a/lib/libifconfig/libifconfig_media.c +++ b/lib/libifconfig/libifconfig_media.c @@ -392,3 +392,13 @@ ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen) } } } + +int +ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, +struct ifdownreason *ifdr) +{ + + (void)memset(ifdr, 0, sizeof(*ifdr)); + (void)strlcpy(ifdr->ifdr_name, name, sizeof(ifdr->ifdr_name)); + return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDOWNREASON, ifdr)); +} ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: ee21ee1572d4 - main - openzfs: attach pam_zfs_key to build
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=ee21ee1572d40a3b74f18638dae38c1a9ad1e9e3 commit ee21ee1572d40a3b74f18638dae38c1a9ad1e9e3 Author: Greg V AuthorDate: 2021-03-02 11:01:14 + Commit: Ryan Moeller CommitDate: 2021-03-02 12:26:59 + openzfs: attach pam_zfs_key to build This PAM module allows unlocking encrypted user home datasets when logging in (and changing passphrase when changing the account password), see https://github.com/openzfs/zfs/pull/9903 Also supposed to unload the key when the last session for the user is done, but there are EBUSY issues: https://github.com/openzfs/zfs/issues/11222#issuecomment-731897858 Submitted by: Greg V Reviewed by:mm MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28018 --- cddl/lib/Makefile | 7 ++- cddl/lib/pam_zfs_key/Makefile | 28 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile index 2f360a8684a2..ae6862f70443 100644 --- a/cddl/lib/Makefile +++ b/cddl/lib/Makefile @@ -17,7 +17,8 @@ SUBDIR= drti \ ${_libzfs} \ ${_libzfsbootenv} \ ${_libzpool} \ - ${_libzutil} + ${_libzutil} \ + ${_pam_zfs_key} SUBDIR.${MK_TESTS}+= tests @@ -30,6 +31,9 @@ _libzutil=libzutil _libzfsbootenv=libzfsbootenv _libzpool= libzpool _libtpool= libtpool +.if ${MK_OPENSSL} != "no" +_pam_zfs_key= pam_zfs_key +.endif .endif SUBDIR_DEPEND_libctf= libspl @@ -41,6 +45,7 @@ SUBDIR_DEPEND_libzfs= libavl libnvpair libumem libuutil libzfs_core libzutil SUBDIR_DEPEND_libzpool=libavl libnvpair libumem libicp SUBDIR_DEPEND_libzutil=libavl libtpool SUBDIR_DEPEND_libzfsbootenv= libzfs libnvpair +SUBDIR_DEPEND_pam_zfs_key= libnvpair libuutil libzfs libzfs_core SUBDIR_PARALLEL= diff --git a/cddl/lib/pam_zfs_key/Makefile b/cddl/lib/pam_zfs_key/Makefile new file mode 100644 index ..cf43802090dd --- /dev/null +++ b/cddl/lib/pam_zfs_key/Makefile @@ -0,0 +1,28 @@ +.PATH: ${SRCTOP}/sys/contrib/openzfs/contrib/pam_zfs_key +.PATH: ${SRCTOP}/sys/contrib/openzfs/include + +PACKAGE= utilities +LIB= pam_zfs_key + +SHLIBDIR?= /usr/lib + +LIBADD=zfs zfs_core nvpair uutil crypto + +SRCS= pam_zfs_key.c + +WARNS?=2 +CSTD= c99 +CFLAGS+= -DIN_BASE +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/ +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs +CFLAGS+= -DRUNSTATEDIR=\"/var/run\" + +.include "../../lib/libpam/modules/Makefile.inc" +.include ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: e175b519a6fb - main - lib/flua/libjail: Allow empty params table
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=e175b519a6fb83889fb3ca679b73d11ea5bea7ad commit e175b519a6fb83889fb3ca679b73d11ea5bea7ad Author: Ryan Moeller AuthorDate: 2021-02-25 05:16:52 + Commit: Ryan Moeller CommitDate: 2021-03-02 23:32:22 + lib/flua/libjail: Allow empty params table The name or jid always gets added to the params, and that's enough to avoid allocating a 0 length params array. Reported by:kevans Reviewed by:kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28778 --- lib/flua/libjail/lua_jail.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index 9981fd5421c6..b66c60b43bc8 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -113,7 +113,6 @@ l_getparams(lua_State *L) "expected a jail name (string) or id (integer)"); luaL_checktype(L, 2, LUA_TTABLE); params_count = 1 + lua_rawlen(L, 2); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); params = malloc(params_count * sizeof(struct jailparam)); @@ -236,7 +235,6 @@ l_setparams(lua_State *L) lua_pushnil(L); for (params_count = 1; lua_next(L, 2) != 0; ++params_count) lua_pop(L, 1); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 8b22242550c9 - main - sbin/ifconfig: Use a global libifconfig handle
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=8b22242550c98d0a59b6589f2be0beb1dc2eac13 commit 8b22242550c98d0a59b6589f2be0beb1dc2eac13 Author: Ryan Moeller AuthorDate: 2021-02-28 10:30:09 + Commit: Ryan Moeller CommitDate: 2021-03-03 02:15:40 + sbin/ifconfig: Use a global libifconfig handle This should eventually replace the socket passed to the various handlers. In the meantime, making it global avoids repeatedly opening and closing handles. Reported by:kp Reviewed by:kp (earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28990 --- sbin/ifconfig/carp.c | 9 + sbin/ifconfig/ifbridge.c | 9 + sbin/ifconfig/ifclone.c | 6 -- sbin/ifconfig/ifconfig.c | 9 + sbin/ifconfig/ifconfig.h | 5 + sbin/ifconfig/ifgroup.c | 9 + sbin/ifconfig/iflagg.c | 9 + sbin/ifconfig/sfp.c | 14 +++--- 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index d6f8d78ba920..23a119e3b9d7 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -73,14 +73,9 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - ifconfig_handle_t *lifh; - - lifh = ifconfig_open(); - if (lifh == NULL) - return; if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) - goto close; + return; for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", @@ -91,8 +86,6 @@ carp_status(int s) else printf("\n"); } -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index cc1520a2e3f0..2bd9c96f2489 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -156,19 +156,14 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - ifconfig_handle_t *lifh; struct ifconfig_bridge_status *bridge; struct ifbropreq *params; const char *pad, *prefix; uint8_t lladdr[ETHER_ADDR_LEN]; uint16_t bprio; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_bridge_get_bridge_status(lifh, name, &bridge) == -1) - goto close; + return; params = bridge->params; @@ -227,8 +222,6 @@ bridge_status(int s) } ifconfig_bridge_free_bridge_status(bridge); -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c index ad39bd43757a..9cacff239967 100644 --- a/sbin/ifconfig/ifclone.c +++ b/sbin/ifconfig/ifclone.c @@ -57,17 +57,11 @@ typedef enum { static void list_cloners(void) { - ifconfig_handle_t *lifh; char *cloners; size_t cloners_count; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); - ifconfig_close(lifh); for (const char *name = cloners; name < cloners + cloners_count * IFNAMSIZ; diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 5b12baa0656e..fc5351bd420e 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -78,8 +78,12 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" +ifconfig_handle_t *lifh; + /* * Since "struct ifreq" is composed of various union members, callers * should pay special attention to interpret the value. @@ -427,6 +431,10 @@ main(int argc, char *argv[]) f_inet = f_inet6 = f_ether = f_addr = NULL; matchgroup = nogroup = NULL; + lifh = ifconfig_open(); + if (lifh == NULL) + err(EXIT_FAILURE, "ifconfig_open"); + envformat = getenv("IFCONFIG_FORMAT"); if (envformat != NULL) setformat(envformat); @@ -699,6 +707,7 @@ main(int argc, char *argv[]) done: freeformat(); + ifconfig_close(lifh); exit(exit_code); } diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 67c25f5921d6..61b1137b47ba 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -36,6 +36,10 @@ * $FreeBSD$ */ +#pragma once + +#include + #define__constructor __attribute__((constructor)) struct afswtch; @@ -128,6 +132,7 @@ struct option { }; void opt_register(struct option *); +extern ifconfig_handle_t *lifh; extern struct ifreq ifr; extern char name[IFNAMSIZ];/* name of interface
git: 80545a16df95 - main - libifconfig: Fix typo in symbol map
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=80545a16df95263781b3422695527b6238f4bd2c commit 80545a16df95263781b3422695527b6238f4bd2c Author: Ryan Moeller AuthorDate: 2021-03-03 01:55:18 + Commit: Ryan Moeller CommitDate: 2021-03-03 02:19:42 + libifconfig: Fix typo in symbol map MFC after: 1 week --- lib/libifconfig/Symbol.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index b3e81d6ee497..235092376b11 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -10,7 +10,7 @@ FBSD_1.6 { ifconfig_err_errtype; ifconfig_err_ioctlreq; ifconfig_foreach_ifaddr; - ifconfig_foreach_interface; + ifconfig_foreach_iface; ifconfig_get_capability; ifconfig_get_description; ifconfig_get_fib; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: c4ba4aa54718 - main - libifconfig: Overhaul ifconfig_media_* interfaces
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=c4ba4aa547184ab401204096cdad9def4ab37964 commit c4ba4aa547184ab401204096cdad9def4ab37964 Author: Ryan Moeller AuthorDate: 2021-03-02 10:29:17 + Commit: Ryan Moeller CommitDate: 2021-03-05 09:15:55 + libifconfig: Overhaul ifconfig_media_* interfaces Define an ifmedia_t type to use for ifmedia words. Add ifconfig_media_lookup_* functions to lookup ifmedia words by name. Get media options as an array of option names rather than formatting it as a comma-delimited list into a buffer. Sprinkle const on static the static description tables for peace of mind. Don't need to zero memory allocated by calloc. Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29029 --- lib/libifconfig/Makefile| 2 +- lib/libifconfig/Symbol.map | 9 +- lib/libifconfig/libifconfig.h | 69 +++- lib/libifconfig/libifconfig_media.c | 339 share/examples/libifconfig/status.c | 27 ++- 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 73dad36c1dc5..c6f006018427 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -7,7 +7,7 @@ INTERNALLIB=true LIBADD=m SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index 235092376b11..2d80fb31652a 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -26,12 +26,17 @@ FBSD_1.6 { ifconfig_lagg_get_lagg_status; ifconfig_lagg_get_laggport_status; ifconfig_list_cloners; + ifconfig_media_get_downreason; ifconfig_media_get_mediareq; - ifconfig_media_get_options_string; + ifconfig_media_get_mode; + ifconfig_media_get_options; ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; - ifconfig_media_get_downreason; + ifconfig_media_lookup_mode; + ifconfig_media_lookup_options; + ifconfig_media_lookup_subtype; + ifconfig_media_lookup_type; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index d8245ea13b23..e1cd6d1821a5 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -202,10 +202,73 @@ int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, */ int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, struct ifmediareq **ifmr); -const char *ifconfig_media_get_type(int ifmw); -const char *ifconfig_media_get_subtype(int ifmw); + const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); -void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); + +typedef int ifmedia_t; + +#define INVALID_IFMEDIA ((ifmedia_t)-1) + +/** Retrieve the name of a media type + * @param mediaThe media to be named + * @return A pointer to the media type name, or NULL on failure + */ +const char *ifconfig_media_get_type(ifmedia_t media); + +/** Retrieve a media type by its name + * @param name The name of a media type + * @return The media type value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_type(const char *name); + +/** Retrieve the name of a media subtype + * @param mediaThe media subtype to be named + * @return A pointer to the media subtype name, or NULL on failure + */ +const char *ifconfig_media_get_subtype(ifmedia_t media); + +/** Retrieve a media subtype by its name + * @param mediaThe top level media type whose subtype we want + * @param name The name of a media subtype + * @return The media subtype value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_subtype(ifmedia_t media, const char *name); + +/** Retrieve the name of a media mode + * @param mediaThe media mode to be named + * @return A pointer to the media mode name, or NULL on failure + */ +const char *ifconfig_media_get_mode(ifmedia_t media); + +/** Retrieve a media mode by its name + * @param mediaThe top level media type whose mode we want + * @param name The name of a media mode + * @return The media mode value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_mode(ifmedia_t media, const char *name); + +/** Retrieve an array of media options + * @param mediaThe media for which to obtain the options + * @return Pointer to an array of pointers to option names, + * terminated by a NULL pointer, or simply NULL on failure. + * The caller is responsible for freeing the array bu
git: 2803fa471e77 - main - sbin/ifconfig: Get media status with libifconfig
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=2803fa471e77dc8f227fe00bbf075de7feb10022 commit 2803fa471e77dc8f227fe00bbf075de7feb10022 Author: Ryan Moeller AuthorDate: 2021-02-28 20:27:28 + Commit: Ryan Moeller CommitDate: 2021-03-05 09:15:55 + sbin/ifconfig: Get media status with libifconfig Code deduplication. Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29030 --- sbin/ifconfig/ifconfig.h| 2 +- sbin/ifconfig/ifieee80211.c | 2 +- sbin/ifconfig/ifmedia.c | 673 3 files changed, 176 insertions(+), 501 deletions(-) diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 61b1137b47ba..ea541c5e9257 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -161,7 +161,7 @@ voidsfp_status(int s, struct ifreq *ifr, int verbose); * XXX expose this so modules that neeed to know of any pending * operations on ifmedia can avoid cmd line ordering confusion. */ -struct ifmediareq *ifmedia_getstate(int s); +struct ifmediareq *ifmedia_getstate(void); void print_vhid(const struct ifaddrs *, const char *); diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index bb406469829a..cfaf163f5930 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -239,7 +239,7 @@ getchaninfo(int s) if (get80211(s, IEEE80211_IOC_CHANINFO, chaninfo, IEEE80211_CHANINFO_SIZE(MAXCHAN)) < 0) err(1, "unable to get channel information"); - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); gethtconf(s); getvhtconf(s); } diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index cd3600df454c..66eb40254889 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -86,201 +86,103 @@ #include #include +#include + #include "ifconfig.h" -static voiddomediaopt(const char *, int, int); -static int get_media_subtype(int, const char *); -static int get_media_mode(int, const char *); -static int get_media_options(int, const char *); -static int lookup_media_word(struct ifmedia_description *, const char *); -static voidprint_media_word(int, int); -static voidprint_media_word_ifconfig(int); - -static struct ifmedia_description *get_toptype_desc(int); -static struct ifmedia_type_to_subtype *get_toptype_ttos(int); -static struct ifmedia_description *get_subtype_desc(int, -struct ifmedia_type_to_subtype *ttos); - -#defineIFM_OPMODE(x) \ - ((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \ -IFM_IEEE80211_IBSS | IFM_IEEE80211_WDS | IFM_IEEE80211_MONITOR | \ -IFM_IEEE80211_MBSS)) -#defineIFM_IEEE80211_STA 0 +static void domediaopt(const char *, bool, int); +static ifmedia_t get_media_subtype(ifmedia_t, const char *); +static ifmedia_t get_media_mode(ifmedia_t, const char *); +static ifmedia_t get_media_options(ifmedia_t, const char *); +static void print_media(ifmedia_t, bool); +static void print_media_ifconfig(ifmedia_t); static void media_status(int s) { - struct ifmediareq ifmr; - struct ifdownreason ifdr; - int *media_list, i; - bool no_carrier, xmedia; - - (void) memset(&ifmr, 0, sizeof(ifmr)); - (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); - xmedia = true; + struct ifmediareq *ifmr; - /* -* Check if interface supports extended media types. -*/ - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = false; - if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { - /* -* Interface doesn't support SIOC{G,S}IFMEDIA. -*/ + if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) return; - } - if (ifmr.ifm_count == 0) { + if (ifmr->ifm_count == 0) { warnx("%s: no media types?", name); - return; - } - - media_list = (int *)malloc(ifmr.ifm_count * sizeof(int)); - if (media_list == NULL) - err(1, "malloc"); - ifmr.ifm_ulist = media_list; - - if (xmedia) { - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFXMEDIA"); - } else { - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); + goto free; } printf("\tmedia: "); - print_media_word(ifmr.ifm_current, 1); - if (ifmr.ifm_active != ifmr.ifm_current) { + print_media(ifmr->ifm_current, true); + if (ifmr->ifm_active != ifmr->ifm_current) { putc
git: 88832d59dec1 - main - sbin/ifconfig: Minor housekeeping
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=88832d59dec10e97dd64b44391606776b20e782b commit 88832d59dec10e97dd64b44391606776b20e782b Author: Ryan Moeller AuthorDate: 2021-02-28 02:08:43 + Commit: Ryan Moeller CommitDate: 2021-03-05 09:15:55 + sbin/ifconfig: Minor housekeeping Coalesce adjacent lint ifdefs. Fix spelling of nitems. Reviewed by:kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29022 --- sbin/ifconfig/ifconfig.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index fc5351bd420e..5e114b43c126 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -33,9 +33,6 @@ static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif @@ -215,8 +212,6 @@ ioctl_ifcreate(int s, struct ifreq *ifr) } } -#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) - static int calcorders(struct ifaddrs *ifa, struct ifa_queue *q) { @@ -246,7 +241,7 @@ calcorders(struct ifaddrs *ifa, struct ifa_queue *q) if (ifa->ifa_addr) { af = ifa->ifa_addr->sa_family; - if (af < ORDERS_SIZE(cur->af_orders) && + if (af < nitems(cur->af_orders) && cur->af_orders[af] == 0) cur->af_orders[af] = ++ord; } @@ -297,8 +292,7 @@ cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q) af1 = a->ifa_addr->sa_family; af2 = b->ifa_addr->sa_family; - if (af1 < ORDERS_SIZE(e1->af_orders) && - af2 < ORDERS_SIZE(e1->af_orders)) + if (af1 < nitems(e1->af_orders) && af2 < nitems(e1->af_orders)) return (e1->af_orders[af1] - e1->af_orders[af2]); } @@ -347,8 +341,6 @@ static void setformat(char *input) free(formatstr); } -#undef ORDERS_SIZE - static struct ifaddrs * sortifaddrs(struct ifaddrs *list, int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
Re: git: c4ba4aa54718 - main - libifconfig: Overhaul ifconfig_media_* interfaces
On 3/5/21 1:19 PM, Konstantin Belousov wrote: On Fri, Mar 05, 2021 at 11:23:56AM +, Ryan Moeller wrote: The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=c4ba4aa547184ab401204096cdad9def4ab37964 commit c4ba4aa547184ab401204096cdad9def4ab37964 Author: Ryan Moeller AuthorDate: 2021-03-02 10:29:17 + Commit: Ryan Moeller CommitDate: 2021-03-05 09:15:55 + libifconfig: Overhaul ifconfig_media_* interfaces Define an ifmedia_t type to use for ifmedia words. Add ifconfig_media_lookup_* functions to lookup ifmedia words by name. Get media options as an array of option names rather than formatting it as a comma-delimited list into a buffer. Sprinkle const on static the static description tables for peace of mind. Don't need to zero memory allocated by calloc. Reviewed by:kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29029 --- lib/libifconfig/Makefile| 2 +- lib/libifconfig/Symbol.map | 9 +- lib/libifconfig/libifconfig.h | 69 +++- lib/libifconfig/libifconfig_media.c | 339 share/examples/libifconfig/status.c | 27 ++- 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 73dad36c1dc5..c6f006018427 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -7,7 +7,7 @@ INTERNALLIB=true LIBADD= m SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map libifconfig is marked as internal, but we provide symbol versioning for it, and do it in the normal FreeBSD namespace. On one hand, our policy is to not bump symvered libs and to provide binary compat shims as needed, on the other, this is internal lib. What is the purpose of maintaining symbol versions for it? I have work in progress that changes libifconfig to a private lib. I'm not sure why markj@ added the symbol map, but I've been forced to maintain it for my later changes to work. -Ryan ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
Re: git: c4ba4aa54718 - main - libifconfig: Overhaul ifconfig_media_* interfaces
On 3/6/21 4:07 AM, Kristof Provost wrote: On 5 Mar 2021, at 20:44, Mark Johnston wrote: On Fri, Mar 05, 2021 at 02:40:29PM -0500, Ryan Moeller wrote: On 3/5/21 1:19 PM, Konstantin Belousov wrote: On Fri, Mar 05, 2021 at 11:23:56AM +, Ryan Moeller wrote: The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=c4ba4aa547184ab401204096cdad9def4ab37964 <https://cgit.FreeBSD.org/src/commit/?id=c4ba4aa547184ab401204096cdad9def4ab37964> commit c4ba4aa547184ab401204096cdad9def4ab37964 Author: Ryan Moeller AuthorDate: 2021-03-02 10:29:17 + Commit: Ryan Moeller CommitDate: 2021-03-05 09:15:55 + libifconfig: Overhaul ifconfig_media_* interfaces Define an ifmedia_t type to use for ifmedia words. Add ifconfig_media_lookup_* functions to lookup ifmedia words by name. Get media options as an array of option names rather than formatting it as a comma-delimited list into a buffer. Sprinkle const on static the static description tables for peace of mind. Don't need to zero memory allocated by calloc. Reviewed by: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29029 <https://reviews.freebsd.org/D29029> --- lib/libifconfig/Makefile | 2 +- lib/libifconfig/Symbol.map | 9 +- lib/libifconfig/libifconfig.h | 69 +++- lib/libifconfig/libifconfig_media.c | 339 share/examples/libifconfig/status.c | 27 ++- 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 73dad36c1dc5..c6f006018427 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -7,7 +7,7 @@ INTERNALLIB= true LIBADD= m SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map libifconfig is marked as internal, but we provide symbol versioning for it, and do it in the normal FreeBSD namespace. On one hand, our policy is to not bump symvered libs and to provide binary compat shims as needed, on the other, this is internal lib. What is the purpose of maintaining symbol versions for it? I have work in progress that changes libifconfig to a private lib. I'm not sure why markj@ added the symbol map, but I've been forced to maintain it for my later changes to work. I added it because there was some discussion of making it a public library, and adding a symbol map was a step towards that. If it is only going to be a private library, then there's indeed no reason to maintain it. Historically it’s been the aspiration (passive voice, because while these have been my hopes I’ve not done any of the work) to make this a public library, so e.g. appliance vendors could have a better way to configure the system than doing |system(“ifconfig em0 10.0.0.1/24”);|. Libifconfig is making progress thanks to Ryan’s work, but it’s not yet ready for that sort of use. Given that, it makes sense to keep it as an internal library for now, and breaking the API is fine. I still hope that we’ll get it to the point where it’ll be ready for public consumption (with stable API). So I think the symbol map is mostly aspirational right now. If it’s a maintenance burden I guess we can remove it, and re-add it when the time comes. Best regards, Kristof Speaking for myself, I don't find it too much of a burden to keep on top of Symbol.map, but it does feel awkward bumping SHLIB_MAJOR if I don't have to. If it's not necessary to do so for a private library then I will gladly keep it at 2 or even drop it back to 1 if that is preferred while I'm still fleshing out the API. I do have the library switched from internal to private in my local branch so it can be shared with the libifconfig bindings for flua that I've been keeping in sync with the library. ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 0fed2239730f - stable/13 - libifconfig: Set error in ifconfig_get_groups
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=0fed2239730f3bfa7ea71b6468565b8266019526 commit 0fed2239730f3bfa7ea71b6468565b8266019526 Author: Ryan Moeller AuthorDate: 2021-02-27 08:07:21 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:05:01 + libifconfig: Set error in ifconfig_get_groups This should return -1 with OTHER/ENOMEM set in the handle when malloc fails, like everywhere else in libifconfig. Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D28964 (cherry picked from commit 1d9ba697f99a88b321a7d8b96fa142ea774cd3be) --- lib/libifconfig/libifconfig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c index e67c4e4de04e..1733239132a0 100644 --- a/lib/libifconfig/libifconfig.c +++ b/lib/libifconfig/libifconfig.c @@ -511,7 +511,9 @@ ifconfig_get_groups(ifconfig_handle_t *h, const char *name, len = ifgr->ifgr_len; ifgr->ifgr_groups = (struct ifg_req *)malloc(len); if (ifgr->ifgr_groups == NULL) { - return (1); + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); } bzero(ifgr->ifgr_groups, len); if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: caab2f4c89ba - stable/13 - sbin/ifconfig: Minor housekeeping
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=caab2f4c89bae2c44dc056d82e445cc71c183406 commit caab2f4c89bae2c44dc056d82e445cc71c183406 Author: Ryan Moeller AuthorDate: 2021-02-28 02:08:43 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:06 + sbin/ifconfig: Minor housekeeping Coalesce adjacent lint ifdefs. Fix spelling of nitems. Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D29022 (cherry picked from commit 88832d59dec10e97dd64b44391606776b20e782b) --- sbin/ifconfig/ifconfig.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 451532246d40..c99602dd0d84 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -33,9 +33,6 @@ static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif @@ -211,8 +208,6 @@ ioctl_ifcreate(int s, struct ifreq *ifr) } } -#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) - static int calcorders(struct ifaddrs *ifa, struct ifa_queue *q) { @@ -242,7 +237,7 @@ calcorders(struct ifaddrs *ifa, struct ifa_queue *q) if (ifa->ifa_addr) { af = ifa->ifa_addr->sa_family; - if (af < ORDERS_SIZE(cur->af_orders) && + if (af < nitems(cur->af_orders) && cur->af_orders[af] == 0) cur->af_orders[af] = ++ord; } @@ -293,8 +288,7 @@ cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q) af1 = a->ifa_addr->sa_family; af2 = b->ifa_addr->sa_family; - if (af1 < ORDERS_SIZE(e1->af_orders) && - af2 < ORDERS_SIZE(e1->af_orders)) + if (af1 < nitems(e1->af_orders) && af2 < nitems(e1->af_orders)) return (e1->af_orders[af1] - e1->af_orders[af2]); } @@ -343,8 +337,6 @@ static void setformat(char *input) free(formatstr); } -#undef ORDERS_SIZE - static struct ifaddrs * sortifaddrs(struct ifaddrs *list, int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: dc4fae442b86 - stable/13 - sbin/ifconfig: Drop local name var in sfp_status
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=dc4fae442b86cb1c2ffc4732e22392e1832197f4 commit dc4fae442b86cb1c2ffc4732e22392e1832197f4 Author: Ryan Moeller AuthorDate: 2021-02-28 02:15:11 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:05:42 + sbin/ifconfig: Drop local name var in sfp_status There is already a globally defined name variable. (cherry picked from commit 9995455218ff19df9cf0dcaf0198269dc76eeb2d) --- sbin/ifconfig/sfp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c index b7bdc74d42e8..15ff22639060 100644 --- a/sbin/ifconfig/sfp.c +++ b/sbin/ifconfig/sfp.c @@ -62,15 +62,12 @@ sfp_status(int s, struct ifreq *ifr, int verbose) struct ifconfig_sfp_vendor_info vendor_info; struct ifconfig_sfp_status status; ifconfig_handle_t *lifh; - const char *name; size_t channel_count; lifh = ifconfig_open(); if (lifh == NULL) return; - name = ifr->ifr_name; - if (ifconfig_sfp_get_sfp_info(lifh, name, &info) == -1) goto close; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: f42188552c77 - stable/13 - sbin/ifconfig: Get carp status with libifconfig
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=f42188552c7784b6a0e14d591d0e3951164b5326 commit f42188552c7784b6a0e14d591d0e3951164b5326 Author: Ryan Moeller AuthorDate: 2021-02-26 23:40:58 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:35 + sbin/ifconfig: Get carp status with libifconfig A trivial change now that ifconfig is already using libifconfig. Reviewed by:kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28955 (cherry picked from commit da393346ac47b22b5f8af4040a59971faadd2c5c) --- sbin/ifconfig/carp.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index dcf966d873ee..d6f8d78ba920 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -50,6 +50,8 @@ #include #include +#include + #include "ifconfig.h" static const char *carp_states[] = { CARP_STATES }; @@ -71,16 +73,16 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - int i; + ifconfig_handle_t *lifh; - bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID); - carpr[0].carpr_count = CARP_MAXVHID; - ifr.ifr_data = (caddr_t)&carpr; - - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + lifh = ifconfig_open(); + if (lifh == NULL) return; - for (i = 0; i < carpr[0].carpr_count; i++) { + if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) + goto close; + + for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid, carpr[i].carpr_advbase, carpr[i].carpr_advskew); @@ -89,6 +91,8 @@ carp_status(int s) else printf("\n"); } +close: + ifconfig_close(lifh); } static void ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: d63acd26f92b - stable/13 - libifconfig: Fix typo in symbol map
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=d63acd26f92bdd6bb0f0ee481881c054d98de357 commit d63acd26f92bdd6bb0f0ee481881c054d98de357 Author: Ryan Moeller AuthorDate: 2021-03-03 01:55:18 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:06:30 + libifconfig: Fix typo in symbol map (cherry picked from commit 80545a16df95263781b3422695527b6238f4bd2c) --- lib/libifconfig/Symbol.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index fd147554f085..ec1ccec7f95c 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -10,7 +10,7 @@ FBSD_1.6 { ifconfig_err_errtype; ifconfig_err_ioctlreq; ifconfig_foreach_ifaddr; - ifconfig_foreach_interface; + ifconfig_foreach_iface; ifconfig_get_capability; ifconfig_get_description; ifconfig_get_fib; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 8eb38ceffef8 - stable/13 - sbin/ifconfig: Get groups with libifconfig
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=8eb38ceffef8ee54f65fb914b941742f718e85ab commit 8eb38ceffef8ee54f65fb914b941742f718e85ab Author: Ryan Moeller AuthorDate: 2021-02-27 08:17:04 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:55 + sbin/ifconfig: Get groups with libifconfig Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D28965 (cherry picked from commit 64bacab177f7c743af3268a3e1ffcddaf77a68d0) --- sbin/ifconfig/ifgroup.c | 38 +++--- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c index 50d17ca6429e..2b13227af4f3 100644 --- a/sbin/ifconfig/ifgroup.c +++ b/sbin/ifconfig/ifgroup.c @@ -43,6 +43,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" /* ARGSUSED */ @@ -84,33 +86,21 @@ unsetifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) static void getifgroups(int s) { - int len, cnt; - struct ifgroupreqifgr; - struct ifg_req *ifg; - - memset(&ifgr, 0, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, name, IFNAMSIZ); + ifconfig_handle_t *lifh; + struct ifgroupreq ifgr; + size_t cnt; - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) { - if (errno == EINVAL || errno == ENOTTY) - return; - else - err(1, "SIOCGIFGROUP"); - } + lifh = ifconfig_open(); + if (lifh == NULL) + return; - len = ifgr.ifgr_len; - ifgr.ifgr_groups = - (struct ifg_req *)calloc(len / sizeof(struct ifg_req), - sizeof(struct ifg_req)); - if (ifgr.ifgr_groups == NULL) - err(1, "getifgroups"); - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) - err(1, "SIOCGIFGROUP"); + if (ifconfig_get_groups(lifh, name, &ifgr) == -1) + goto close; cnt = 0; - ifg = ifgr.ifgr_groups; - for (; ifg && len >= sizeof(struct ifg_req); ifg++) { - len -= sizeof(struct ifg_req); + for (size_t i = 0; i < ifgr.ifgr_len / sizeof(struct ifg_req); ++i) { + struct ifg_req *ifg = &ifgr.ifgr_groups[i]; + if (strcmp(ifg->ifgrq_group, "all")) { if (cnt == 0) printf("\tgroups:"); @@ -122,6 +112,8 @@ getifgroups(int s) printf("\n"); free(ifgr.ifgr_groups); +close: + ifconfig_close(lifh); } static void ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 4e535a1ba72e - stable/13 - lib/flua/libjail: Allow empty params table
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4e535a1ba72e1f751f9cf869ab8c9d06514d6c59 commit 4e535a1ba72e1f751f9cf869ab8c9d06514d6c59 Author: Ryan Moeller AuthorDate: 2021-02-25 05:16:52 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:09:20 + lib/flua/libjail: Allow empty params table The name or jid always gets added to the params, and that's enough to avoid allocating a 0 length params array. Reported by:kevans Reviewed by:kevans Differential Revision: https://reviews.freebsd.org/D28778 (cherry picked from commit e175b519a6fb83889fb3ca679b73d11ea5bea7ad) --- lib/flua/libjail/lua_jail.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index 9981fd5421c6..b66c60b43bc8 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -113,7 +113,6 @@ l_getparams(lua_State *L) "expected a jail name (string) or id (integer)"); luaL_checktype(L, 2, LUA_TTABLE); params_count = 1 + lua_rawlen(L, 2); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); params = malloc(params_count * sizeof(struct jailparam)); @@ -236,7 +235,6 @@ l_setparams(lua_State *L) lua_pushnil(L); for (params_count = 1; lua_next(L, 2) != 0; ++params_count) lua_pop(L, 1); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 3dfbda3401ab - stable/13 - sbin/ifconfig: Get bridge status with libifconfig
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=3dfbda3401abea84da9fd637c1b950fd954f2514 commit 3dfbda3401abea84da9fd637c1b950fd954f2514 Author: Ryan Moeller AuthorDate: 2021-02-26 23:04:38 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:13 + sbin/ifconfig: Get bridge status with libifconfig Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D28954 (cherry picked from commit 6f497e47e925f6886f444a8e31e2e939fca264f2) --- sbin/ifconfig/ifbridge.c | 169 +++ 1 file changed, 69 insertions(+), 100 deletions(-) diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index f4c51632bc98..cc1520a2e3f0 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -61,6 +61,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static const char *stpstates[] = { STP_STATES }; @@ -116,74 +118,6 @@ do_bridgeflag(int sock, const char *ifs, int flag, int set) err(1, "unable to set bridge flags"); } -static void -bridge_interfaces(int s, const char *prefix) -{ - struct ifbifconf bifc; - struct ifbreq *req; - char *inbuf = NULL, *ninbuf; - char *p, *pad; - int i, len = 8192; - - pad = strdup(prefix); - if (pad == NULL) - err(1, "strdup"); - /* replace the prefix with whitespace */ - for (p = pad; *p != '\0'; p++) { - if(isprint(*p)) - *p = ' '; - } - - for (;;) { - ninbuf = realloc(inbuf, len); - if (ninbuf == NULL) - err(1, "unable to allocate interface buffer"); - bifc.ifbic_len = len; - bifc.ifbic_buf = inbuf = ninbuf; - if (do_cmd(s, BRDGGIFS, &bifc, sizeof(bifc), 0) < 0) - err(1, "unable to get interface list"); - if ((bifc.ifbic_len + sizeof(*req)) < len) - break; - len *= 2; - } - - for (i = 0; i < bifc.ifbic_len / sizeof(*req); i++) { - req = bifc.ifbic_req + i; - printf("%s%s ", prefix, req->ifbr_ifsname); - printb("flags", req->ifbr_ifsflags, IFBIFBITS); - printf("\n"); - - printf("%s", pad); - printf("ifmaxaddr %u", req->ifbr_addrmax); - printf(" port %u priority %u", req->ifbr_portno, - req->ifbr_priority); - printf(" path cost %u", req->ifbr_path_cost); - - if (req->ifbr_ifsflags & IFBIF_STP) { - if (req->ifbr_proto < nitems(stpproto)) - printf(" proto %s", stpproto[req->ifbr_proto]); - else - printf(" ", - req->ifbr_proto); - - printf("\n%s", pad); - if (req->ifbr_role < nitems(stproles)) - printf("role %s", stproles[req->ifbr_role]); - else - printf("", - req->ifbr_role); - if (req->ifbr_state < nitems(stpstates)) - printf(" state %s", stpstates[req->ifbr_state]); - else - printf(" ", - req->ifbr_state); - } - printf("\n"); - } - free(pad); - free(inbuf); -} - static void bridge_addresses(int s, const char *prefix) { @@ -222,44 +156,79 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - struct ifbropreq ifbp; - struct ifbrparam param; - u_int16_t pri; - u_int8_t ht, fd, ma, hc, pro; - u_int8_t lladdr[ETHER_ADDR_LEN]; - u_int16_t bprio; - u_int32_t csize, ctime; + ifconfig_handle_t *lifh; + struct ifconfig_bridge_status *bridge; + struct ifbropreq *params; + const char *pad, *prefix; + uint8_t lladdr[ETHER_ADDR_LEN]; + uint16_t bprio; - if (do_cmd(s, BRDGGCACHE, ¶m, sizeof(param), 0) < 0) - return; - csize = param.ifbrp_csize; - if (do_cmd(s, BRDGGTO, ¶m, sizeof(param), 0) < 0) - return; - ctime = param.ifbrp_ctime; - if (do_cmd(s, BRDGPARAM, &ifbp, sizeof(ifbp), 0) < 0) + lifh = ifconfig_open(); + if (lifh == NULL) return; - pri = ifbp.ifbop_priority; -
git: ca459d253fa3 - stable/13 - libifconfig: Add a function to get down reason
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=ca459d253fa3128426383b13b7a51e9a05c09bcb commit ca459d253fa3128426383b13b7a51e9a05c09bcb Author: Ryan Moeller AuthorDate: 2021-02-28 09:34:30 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:29 + libifconfig: Add a function to get down reason For use in ifconfig. Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D28991 (cherry picked from commit b12a960e4274926171dc7a4f9887a0d0a5195b44) --- lib/libifconfig/Symbol.map | 1 + lib/libifconfig/libifconfig.h | 9 + lib/libifconfig/libifconfig_media.c | 10 ++ 3 files changed, 20 insertions(+) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index ec1ccec7f95c..782f78ec5e34 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -31,6 +31,7 @@ FBSD_1.6 { ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; + ifconfig_media_get_downreason; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 46a13ae27d69..d8245ea13b23 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -207,6 +207,15 @@ const char *ifconfig_media_get_subtype(int ifmw); const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); +/** Retrieve the reason the interface is down + * @param hAn open ifconfig state object + * @param name The interface name + * @param ifdr Return argument. + * @return 0 on success, nonzero on failure + */ +int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, +struct ifdownreason *ifdr); + int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, struct carpreq *carpr, int ncarpr); diff --git a/lib/libifconfig/libifconfig_media.c b/lib/libifconfig/libifconfig_media.c index f7302d8a9b24..d7ef507604be 100644 --- a/lib/libifconfig/libifconfig_media.c +++ b/lib/libifconfig/libifconfig_media.c @@ -392,3 +392,13 @@ ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen) } } } + +int +ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, +struct ifdownreason *ifdr) +{ + + (void)memset(ifdr, 0, sizeof(*ifdr)); + (void)strlcpy(ifdr->ifdr_name, name, sizeof(ifdr->ifdr_name)); + return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDOWNREASON, ifdr)); +} ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 137544502b05 - stable/13 - sbin/ifconfig: Get lagg status with libifconfig
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=137544502b0511eef36e2dc78a563d8d803cd2da commit 137544502b0511eef36e2dc78a563d8d803cd2da Author: Ryan Moeller AuthorDate: 2021-02-27 03:05:31 + Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:51 + sbin/ifconfig: Get lagg status with libifconfig Also trimmed an unused block of code that never prints out LAGG_PROTOS. Reviewed by:kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28961 (cherry picked from commit a0ebb915045ed0056decec5f001471af4e999f61) --- sbin/ifconfig/iflagg.c | 144 - 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index 5be8c67cd72a..5e726115662a 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -28,6 +28,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static struct iflaggparam params = { @@ -216,93 +218,87 @@ lacp_format_peer(struct lacp_opreq *req, const char *sep) static void lagg_status(int s) { - struct lagg_protos lpr[] = LAGG_PROTOS; - struct lagg_reqport rpbuf[LAGG_MAX_PORTS]; - struct lagg_reqall ra; - struct lagg_reqopts ro; - struct lagg_reqflags rf; + struct lagg_protos protos[] = LAGG_PROTOS; + ifconfig_handle_t *lifh; + struct ifconfig_lagg_status *lagg; + struct lagg_reqall *ra; + struct lagg_reqflags *rf; + struct lagg_reqopts *ro; + struct lagg_reqport *ports; struct lacp_opreq *lp; - const char *proto = ""; - int i; + const char *proto; - bzero(&ra, sizeof(ra)); - bzero(&ro, sizeof(ro)); + lifh = ifconfig_open(); + if (lifh == NULL) + return; - strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname)); - ra.ra_size = sizeof(rpbuf); - ra.ra_port = rpbuf; + if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) + goto close; - strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname)); - ioctl(s, SIOCGLAGGOPTS, &ro); + ra = lagg->ra; + rf = lagg->rf; + ro = lagg->ro; + ports = ra->ra_port; - strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname)); - if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0) - rf.rf_flags = 0; + proto = ""; + for (size_t i = 0; i < nitems(protos); ++i) { + if (ra->ra_proto == protos[i].lpr_proto) { + proto = protos[i].lpr_name; + break; + } + } + printf("\tlaggproto %s", proto); - if (ioctl(s, SIOCGLAGG, &ra) == 0) { - lp = (struct lacp_opreq *)&ra.ra_lacpreq; + if (rf->rf_flags & LAGG_F_HASHMASK) { + const char *sep = ""; - for (i = 0; i < nitems(lpr); i++) { - if (ra.ra_proto == lpr[i].lpr_proto) { - proto = lpr[i].lpr_name; - break; - } + printf(" lagghash "); + if (rf->rf_flags & LAGG_F_HASHL2) { + printf("%sl2", sep); + sep = ","; } - - printf("\tlaggproto %s", proto); - if (rf.rf_flags & LAGG_F_HASHMASK) { - const char *sep = ""; - - printf(" lagghash "); - if (rf.rf_flags & LAGG_F_HASHL2) { - printf("%sl2", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL3) { - printf("%sl3", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL4) { - printf("%sl4", sep); - sep = ","; - } + if (rf->rf_flags & LAGG_F_HASHL3) { + printf("%sl3", sep); + sep = ","; } - putchar('\n'); - if (verbose) { - printf("\tlagg options:\n"); - printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS); - putchar('\n'); - printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift); - if (ra.ra_proto == LAGG_PROTO_ROUNDROBIN) - printf("
git: 65efb73fbddd - main - sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=65efb73fbddd44116fd39b03991386a67422ba6d commit 65efb73fbddd44116fd39b03991386a67422ba6d Author: Ryan Moeller AuthorDate: 2021-01-27 19:27:46 + Commit: Ryan Moeller CommitDate: 2021-01-27 19:27:46 + sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes The OID is saved when we encounter CTLFLAG_SKIP so that descendants can be skipped as well. We then must not update the skip OID until we are out of the node. This was achieved by resetting the skip OID once the prefix no longer matches, but the case where the OID we reset on has CTLFLAG_SKIP was not accounted for. Reported by:mav Reviewed by:mav MFC after: 2 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D28364 --- sbin/sysctl/sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index bd1e357065dc..30d6d94723fa 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1030,7 +1030,8 @@ show_var(int *oid, int nlen, bool honor_skip) } /* keep track of encountered skip nodes, ignoring descendants */ - if (skip_len == 0 && (kind & CTLFLAG_SKIP) != 0) { + if ((skip_len == 0 || skip_len >= nlen * (int)sizeof(int)) && + (kind & CTLFLAG_SKIP) != 0) { /* Save this oid so we can skip descendants. */ skip_len = nlen * sizeof(int); memcpy(skip_oid, oid, skip_len); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 5d58f58b0d61 - stable/13 - sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=5d58f58b0d612913fd280a6acaf174019bd465ba commit 5d58f58b0d612913fd280a6acaf174019bd465ba Author: Ryan Moeller AuthorDate: 2021-01-27 19:27:46 + Commit: Ryan Moeller CommitDate: 2021-01-29 00:36:46 + sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes The OID is saved when we encounter CTLFLAG_SKIP so that descendants can be skipped as well. We then must not update the skip OID until we are out of the node. This was achieved by resetting the skip OID once the prefix no longer matches, but the case where the OID we reset on has CTLFLAG_SKIP was not accounted for. Reported by:mav Reviewed by:mav Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D28364 (cherry picked from commit 65efb73fbddd44116fd39b03991386a67422ba6d) --- sbin/sysctl/sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index bd1e357065dc..30d6d94723fa 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1030,7 +1030,8 @@ show_var(int *oid, int nlen, bool honor_skip) } /* keep track of encountered skip nodes, ignoring descendants */ - if (skip_len == 0 && (kind & CTLFLAG_SKIP) != 0) { + if ((skip_len == 0 || skip_len >= nlen * (int)sizeof(int)) && + (kind & CTLFLAG_SKIP) != 0) { /* Save this oid so we can skip descendants. */ skip_len = nlen * sizeof(int); memcpy(skip_oid, oid, skip_len); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: e9d419a05357 - main - Set file mode during zfs_write
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=e9d419a05357036ea2fd37218d853d2c713d55cc commit e9d419a05357036ea2fd37218d853d2c713d55cc Author: Antonio Russo AuthorDate: 2021-02-08 17:15:05 + Commit: Ryan Moeller CommitDate: 2021-02-09 17:30:06 + Set file mode during zfs_write Apply https://github.com/openzfs/zfs/pull/11576 Direct commit from upstream openzfs. Full commit message below: Set file mode during zfs_write 3d40b65 refactored zfs_vnops.c, which shared much code verbatim between Linux and BSD. After a successful write, the suid/sgid bits are reset, and the mode to be written is stored in newmode. On Linux, this was propagated to both the in-memory inode and znode, which is then updated with sa_update. 3d40b65 accidentally removed the initialization of newmode, which happened to occur on the same line as the inode update (which has been moved out of the function). The uninitialized newmode can be saved to disk, leading to a crash on stat() of that file, in addition to a merely incorrect file mode. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Antonio Russo Closes #11474 Closes #11576 Obtained from: openzfs/zfs@f8ce8aed0 MFC after: 0 days Sponsored by: iXsystems, Inc. --- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c index 3b7c52b8dd34..2dcc231b30b6 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c @@ -620,6 +620,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr) ((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) { uint64_t newmode; zp->z_mode &= ~(S_ISUID | S_ISGID); + newmode = zp->z_mode; (void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs), (void *)&newmode, sizeof (uint64_t), tx); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 618dee602319 - stable/13 - Set file mode during zfs_write
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=618dee602319166c14c6e12971425d175d4630ed commit 618dee602319166c14c6e12971425d175d4630ed Author: Antonio Russo AuthorDate: 2021-02-08 17:15:05 + Commit: Ryan Moeller CommitDate: 2021-02-09 17:51:04 + Set file mode during zfs_write Apply https://github.com/openzfs/zfs/pull/11576 Direct commit from upstream openzfs. Full commit message below: Set file mode during zfs_write 3d40b65 refactored zfs_vnops.c, which shared much code verbatim between Linux and BSD. After a successful write, the suid/sgid bits are reset, and the mode to be written is stored in newmode. On Linux, this was propagated to both the in-memory inode and znode, which is then updated with sa_update. 3d40b65 accidentally removed the initialization of newmode, which happened to occur on the same line as the inode update (which has been moved out of the function). The uninitialized newmode can be saved to disk, leading to a crash on stat() of that file, in addition to a merely incorrect file mode. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Antonio Russo Closes #11474 Closes #11576 Obtained from: openzfs/zfs@f8ce8aed0 MFC after: 0 days Sponsored by: iXsystems, Inc. (cherry picked from commit e9d419a05357036ea2fd37218d853d2c713d55cc) --- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c index 3b7c52b8dd34..2dcc231b30b6 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c @@ -620,6 +620,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr) ((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) { uint64_t newmode; zp->z_mode &= ~(S_ISUID | S_ISGID); + newmode = zp->z_mode; (void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs), (void *)&newmode, sizeof (uint64_t), tx); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 7100be11ec2e - releng/13.0 - Set file mode during zfs_write
The branch releng/13.0 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=7100be11ec2e7a79b65ddb727236f23d885aa8a3 commit 7100be11ec2e7a79b65ddb727236f23d885aa8a3 Author: Antonio Russo AuthorDate: 2021-02-08 17:15:05 + Commit: Ryan Moeller CommitDate: 2021-02-09 18:13:25 + Set file mode during zfs_write Apply https://github.com/openzfs/zfs/pull/11576 Direct commit from upstream openzfs. Full commit message below: Set file mode during zfs_write 3d40b65 refactored zfs_vnops.c, which shared much code verbatim between Linux and BSD. After a successful write, the suid/sgid bits are reset, and the mode to be written is stored in newmode. On Linux, this was propagated to both the in-memory inode and znode, which is then updated with sa_update. 3d40b65 accidentally removed the initialization of newmode, which happened to occur on the same line as the inode update (which has been moved out of the function). The uninitialized newmode can be saved to disk, leading to a crash on stat() of that file, in addition to a merely incorrect file mode. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Antonio Russo Closes #11474 Closes #11576 Approved by:re (gdb) Obtained from: openzfs/zfs@f8ce8aed0 Sponsored by: iXsystems, Inc. (cherry picked from commit e9d419a05357036ea2fd37218d853d2c713d55cc) (cherry picked from commit 618dee602319166c14c6e12971425d175d4630ed) --- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c index 3b7c52b8dd34..2dcc231b30b6 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c @@ -620,6 +620,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr) ((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) { uint64_t newmode; zp->z_mode &= ~(S_ISUID | S_ISGID); + newmode = zp->z_mode; (void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs), (void *)&newmode, sizeof (uint64_t), tx); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 94dc57159532 - main - libcasper: Create a minimal cap_netdb service
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=94dc57159532d7bbf94d109e79fd202a57150562 commit 94dc57159532d7bbf94d109e79fd202a57150562 Author: Ryan Moeller AuthorDate: 2021-03-26 19:40:19 + Commit: Ryan Moeller CommitDate: 2021-06-05 12:36:53 + libcasper: Create a minimal cap_netdb service Create a casper service for netdb functions. Initially only cap_getprotobyname is implemented. This is needed for capsicumizing sockstat. Reviewed by:oshogbo, bcr (manpages) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D24832 --- lib/libcasper/services/Makefile| 1 + lib/libcasper/services/cap_netdb/Makefile | 32 + lib/libcasper/services/cap_netdb/cap_netdb.3 | 90 lib/libcasper/services/cap_netdb/cap_netdb.c | 155 + lib/libcasper/services/cap_netdb/cap_netdb.h | 49 +++ lib/libcasper/services/cap_netdb/tests/Makefile| 14 ++ .../services/cap_netdb/tests/netdb_test.c | 94 + share/mk/src.libnames.mk | 1 + 8 files changed, 436 insertions(+) diff --git a/lib/libcasper/services/Makefile b/lib/libcasper/services/Makefile index 8fcb2e1e5c64..dfd4aaa76653 100644 --- a/lib/libcasper/services/Makefile +++ b/lib/libcasper/services/Makefile @@ -6,6 +6,7 @@ SUBDIR= cap_dns SUBDIR+= cap_fileargs SUBDIR+= cap_grp SUBDIR+= cap_net +SUBDIR+= cap_netdb SUBDIR+= cap_pwd SUBDIR+= cap_sysctl SUBDIR+= cap_syslog diff --git a/lib/libcasper/services/cap_netdb/Makefile b/lib/libcasper/services/cap_netdb/Makefile new file mode 100644 index ..5070976d2e25 --- /dev/null +++ b/lib/libcasper/services/cap_netdb/Makefile @@ -0,0 +1,32 @@ +# $FreeBSD$ + +SHLIBDIR?= /lib/casper + +.include + +PACKAGE= runtime + +SHLIB_MAJOR= 1 +INCSDIR?= ${INCLUDEDIR}/casper + +.if ${MK_CASPER} != "no" +SHLIB= cap_netdb + +SRCS= cap_netdb.c +.endif + +INCS= cap_netdb.h + +LIBADD=nv + +CFLAGS+=-I${.CURDIR} + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + +MAN+= cap_netdb.3 + +MLINKS+=cap_netdb.3 libcap_netdb.3 +MLINKS+=cap_netdb.3 cap_getprotobyname.3 + +.include diff --git a/lib/libcasper/services/cap_netdb/cap_netdb.3 b/lib/libcasper/services/cap_netdb/cap_netdb.3 new file mode 100644 index ..6df34559224c --- /dev/null +++ b/lib/libcasper/services/cap_netdb/cap_netdb.3 @@ -0,0 +1,90 @@ +.\" Copyright (c) 2020 Ryan Moeller +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 12, 2020 +.Dt CAP_NETDB 3 +.Os +.Sh NAME +.Nm cap_getprotobyname , +.Nd "library for getting network proto entry in capability mode" +.Sh LIBRARY +.Lb libcap_netdb +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_netdb.h +.Ft "struct protoent *" +.Fn cap_getprotobyname "const cap_channel_t *chan" "const char *name" +.Sh DESCRIPTION +.Bf -symbolic +The function +.Fn cap_getprotobyname +is equivalent to +.Xr getprotobyname 3 +except that the connection to the +.Nm system.netdb +service needs to be provided. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.netdb +casper service and uses it to look up a protocol by name. +.Bd -literal +cap_channel_t *capcas, *capnetdb; +struct protoent *ent; + +/* Open capability to Casper. */ +capcas = ca
git: c5a2d8c5f517 - main - sockstat: Use libcasper to capsicumize
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=c5a2d8c5f517b056bed2af64e6134481367773d4 commit c5a2d8c5f517b056bed2af64e6134481367773d4 Author: Ryan Moeller AuthorDate: 2021-03-26 19:42:19 + Commit: Ryan Moeller CommitDate: 2021-06-05 12:36:55 + sockstat: Use libcasper to capsicumize Drop rights we do not need. This has to be done after jail_attach. Reviewed by:oshogbo Relnotes: yes Differential Revision: https://reviews.freebsd.org/D26958 --- usr.bin/sockstat/Makefile | 10 ++ usr.bin/sockstat/sockstat.c | 80 + 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/usr.bin/sockstat/Makefile b/usr.bin/sockstat/Makefile index 2f8f9655e8db..6d0de7dc22d0 100644 --- a/usr.bin/sockstat/Makefile +++ b/usr.bin/sockstat/Makefile @@ -1,7 +1,17 @@ # $FreeBSD$ +.include + PROG= sockstat LIBADD=jail +.if ${MK_CASPER} != "no" +LIBADD+= casper +LIBADD+= cap_net +LIBADD+= cap_netdb +LIBADD+= cap_sysctl +CFLAGS+= -DWITH_CASPER +.endif + .include diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 109b254b7438..7dc5e4904deb 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -67,6 +68,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include + #definesstosin(ss) ((struct sockaddr_in *)(ss)) #definesstosin6(ss)((struct sockaddr_in6 *)(ss)) #definesstosun(ss) ((struct sockaddr_un *)(ss)) @@ -132,6 +138,10 @@ static struct sock *sockhash[HASHSIZE]; static struct xfile *xfiles; static int nxfiles; +static cap_channel_t *capnet; +static cap_channel_t *capnetdb; +static cap_channel_t *capsysctl; + static int xprintf(const char *fmt, ...) { @@ -153,9 +163,9 @@ get_proto_type(const char *proto) if (strlen(proto) == 0) return (0); - pent = getprotobyname(proto); + pent = cap_getprotobyname(capnetdb, proto); if (pent == NULL) { - warn("getprotobyname"); + warn("cap_getprotobyname"); return (-1); } return (pent->p_proto); @@ -321,17 +331,17 @@ gather_sctp(void) vflag |= INP_IPV6; varname = "net.inet.sctp.assoclist"; - if (sysctlbyname(varname, 0, &len, 0, 0) < 0) { + if (cap_sysctlbyname(capsysctl, varname, 0, &len, 0, 0) < 0) { if (errno != ENOENT) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); return; } if ((buf = (char *)malloc(len)) == NULL) { err(1, "malloc()"); return; } - if (sysctlbyname(varname, buf, &len, 0, 0) < 0) { - err(1, "sysctlbyname()"); + if (cap_sysctlbyname(capsysctl, varname, buf, &len, 0, 0) < 0) { + err(1, "cap_sysctlbyname()"); free(buf); return; } @@ -618,12 +628,13 @@ gather_inet(int proto) if ((buf = realloc(buf, bufsize)) == NULL) err(1, "realloc()"); len = bufsize; - if (sysctlbyname(varname, buf, &len, NULL, 0) == 0) + if (cap_sysctlbyname(capsysctl, varname, buf, &len, + NULL, 0) == 0) break; if (errno == ENOENT) goto out; if (errno != ENOMEM || len != bufsize) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); bufsize *= 2; } xig = (struct xinpgen *)buf; @@ -768,10 +779,11 @@ gather_unix(int proto) if ((buf = realloc(buf, bufsize)) == NULL) err(1, "realloc()"); len = bufsize; - if (sysctlbyname(varname, buf, &len, NULL, 0) == 0) + if (cap_sysctlbyname(capsysctl, varname, buf, &len, + NULL, 0) == 0) break; if (errno != ENOMEM || len != bufsize) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); bufsize *= 2; } xug = (struct xunpgen *)buf; @@
git: 2ea6414ed8bb - main - zfs: Fix typo in module Makefile
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=2ea6414ed8bb4693872967a25c51b7ae15aeddb0 commit 2ea6414ed8bb4693872967a25c51b7ae15aeddb0 Author: Ryan Moeller AuthorDate: 2022-03-09 18:19:42 + Commit: Ryan Moeller CommitDate: 2022-03-09 18:19:42 + zfs: Fix typo in module Makefile Fixes: c03c5b1c8091 Sponsored by: iXsystems, Inc. --- sys/modules/zfs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index 4d82554dae04..a6b7512dda2e 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -377,7 +377,7 @@ CFLAGS.huf_decompress.c= -U__BMI__ -fno-tree-vectorize CFLAGS.pool.c= -U__BMI__ -fno-tree-vectorize CFLAGS.xxhash.c= -U__BMI__ -fno-tree-vectorize CFLAGS.zstd_common.c= -U__BMI__ -fno-tree-vectorize -CFLAGS.std_compress.c= -U__BMI__ -fno-tree-vectorize +CFLAGS.zstd_compress.c= -U__BMI__ -fno-tree-vectorize CFLAGS.zstd_compress_literals.c= -U__BMI__ -fno-tree-vectorize CFLAGS.zstd_compress_sequences.c= -U__BMI__ -fno-tree-vectorize CFLAGS.zstd_compress_superblock.c= -U__BMI__ -fno-tree-vectorize
git: b50db44f021c - main - bsdinstall: Avoid double-mounting /dev
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b50db44f021c12283a2e140063a6b6fcc30295e5 commit b50db44f021c12283a2e140063a6b6fcc30295e5 Author: Ryan Moeller AuthorDate: 2021-06-23 13:42:43 + Commit: Ryan Moeller CommitDate: 2021-06-23 21:24:53 + bsdinstall: Avoid double-mounting /dev After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and unmounting devfs elsewhere already. Reviewed by:nwhitehorn MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30877 --- usr.sbin/bsdinstall/scripts/script | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index cb42aed7706a..8d9dd5205132 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -162,9 +162,7 @@ fi if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript chmod a+x $BSDINSTALL_CHROOT/tmp/installscript - mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1 - umount "$BSDINSTALL_CHROOT/dev" rm $BSDINSTALL_CHROOT/tmp/installscript fi ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 53b438b2425c - main - zfsd: Check for error from zpool_vdev_online
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=53b438b2425c374f6147ac80b3330a9ec08432bb commit 53b438b2425c374f6147ac80b3330a9ec08432bb Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 + Commit: Ryan Moeller CommitDate: 2021-07-06 16:00:18 + zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by:mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index da2125b4d716..8da711fc10cb 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 4b74458dddba - stable/13 - bsdinstall: Avoid double-mounting /dev
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4b74458dddba20cf83e27ba2834aba61e37d0324 commit 4b74458dddba20cf83e27ba2834aba61e37d0324 Author: Ryan Moeller AuthorDate: 2021-06-23 13:42:43 + Commit: Ryan Moeller CommitDate: 2021-07-06 17:04:28 + bsdinstall: Avoid double-mounting /dev After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and unmounting devfs elsewhere already. Reviewed by:nwhitehorn MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30877 (cherry picked from commit b50db44f021c12283a2e140063a6b6fcc30295e5) --- usr.sbin/bsdinstall/scripts/script | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 131ef008d35f..9ed06c1bd36b 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -162,9 +162,7 @@ fi if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript chmod a+x $BSDINSTALL_CHROOT/tmp/installscript - mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1 - umount "$BSDINSTALL_CHROOT/dev" rm $BSDINSTALL_CHROOT/tmp/installscript fi ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: d5a71c929dfa - stable/13 - zfsd: Check for error from zpool_vdev_online
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=d5a71c929dfaab37bf7a8a9278d8cf1e8dfaa4ef commit d5a71c929dfaab37bf7a8a9278d8cf1e8dfaa4ef Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 + Commit: Ryan Moeller CommitDate: 2021-07-13 15:44:32 + zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by:mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 (cherry picked from commit 53b438b2425c374f6147ac80b3330a9ec08432bb) --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index da2125b4d716..8da711fc10cb 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 207b3a418a53 - stable/12 - zfsd: Check for error from zpool_vdev_online
The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=207b3a418a536853af0561b443f32911da18bba9 commit 207b3a418a536853af0561b443f32911da18bba9 Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 + Commit: Ryan Moeller CommitDate: 2021-07-13 15:48:33 + zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by:mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 (cherry picked from commit 53b438b2425c374f6147ac80b3330a9ec08432bb) --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index 19c4abe45fc9..6a4483ec49c2 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -281,9 +281,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 51ce77b26157 - stable/13 - bhyve: ahci: Fix regression with no ports
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=51ce77b261575890d3cecb7529357608b7972ac4 commit 51ce77b261575890d3cecb7529357608b7972ac4 Author: Ryan Moeller AuthorDate: 2022-01-21 12:59:25 + Commit: Ryan Moeller CommitDate: 2022-01-28 14:32:31 + bhyve: ahci: Fix regression with no ports An AHCI controller may be specified with no connected ports. Avoid dumping core in this case for compatibility with existing VM configs. Reviewed by:khng, jhb Fixes: 621b5090487de Refactor configuration management in bhyve. MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D33969 (cherry picked from commit b252fb24301c1f7e7d83eab631e7d9fa947e227d) --- usr.sbin/bhyve/pci_ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 38ec87c34eed..7f7259abfe66 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -2440,7 +2440,7 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) slots = 32; ports_nvl = find_relative_config_node(nvl, "port"); - for (p = 0; p < MAX_PORTS; p++) { + for (p = 0; ports_nvl != NULL && p < MAX_PORTS; p++) { struct ata_params *ata_ident = &sc->port[p].ata_ident; char ident[AHCI_PORT_IDENT];
git: 3b71af08bb84 - stable/13 - sbin/ifconfig: Use a global libifconfig handle
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=3b71af08bb84a0b8f0b1f4066b399cc48bddbfee commit 3b71af08bb84a0b8f0b1f4066b399cc48bddbfee Author: Ryan Moeller AuthorDate: 2021-02-28 10:30:09 + Commit: Ryan Moeller CommitDate: 2021-03-17 22:24:49 + sbin/ifconfig: Use a global libifconfig handle This should eventually replace the socket passed to the various handlers. In the meantime, making it global avoids repeatedly opening and closing handles. Reported by:kp Reviewed by:kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28990 (cherry picked from commit 8b22242550c98d0a59b6589f2be0beb1dc2eac13) --- sbin/ifconfig/carp.c | 9 + sbin/ifconfig/ifbridge.c | 9 + sbin/ifconfig/ifclone.c | 6 -- sbin/ifconfig/ifconfig.c | 9 + sbin/ifconfig/ifconfig.h | 5 + sbin/ifconfig/ifgroup.c | 9 + sbin/ifconfig/iflagg.c | 9 + sbin/ifconfig/sfp.c | 14 +++--- 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index d6f8d78ba920..23a119e3b9d7 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -73,14 +73,9 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - ifconfig_handle_t *lifh; - - lifh = ifconfig_open(); - if (lifh == NULL) - return; if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) - goto close; + return; for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", @@ -91,8 +86,6 @@ carp_status(int s) else printf("\n"); } -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index cc1520a2e3f0..2bd9c96f2489 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -156,19 +156,14 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - ifconfig_handle_t *lifh; struct ifconfig_bridge_status *bridge; struct ifbropreq *params; const char *pad, *prefix; uint8_t lladdr[ETHER_ADDR_LEN]; uint16_t bprio; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_bridge_get_bridge_status(lifh, name, &bridge) == -1) - goto close; + return; params = bridge->params; @@ -227,8 +222,6 @@ bridge_status(int s) } ifconfig_bridge_free_bridge_status(bridge); -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c index ad39bd43757a..9cacff239967 100644 --- a/sbin/ifconfig/ifclone.c +++ b/sbin/ifconfig/ifclone.c @@ -57,17 +57,11 @@ typedef enum { static void list_cloners(void) { - ifconfig_handle_t *lifh; char *cloners; size_t cloners_count; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); - ifconfig_close(lifh); for (const char *name = cloners; name < cloners + cloners_count * IFNAMSIZ; diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index c99602dd0d84..8b1a242db634 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -75,8 +75,12 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" +ifconfig_handle_t *lifh; + /* * Since "struct ifreq" is composed of various union members, callers * should pay special attention to interpret the value. @@ -419,6 +423,10 @@ main(int argc, char *argv[]) f_inet = f_inet6 = f_ether = f_addr = NULL; matchgroup = nogroup = NULL; + lifh = ifconfig_open(); + if (lifh == NULL) + err(EXIT_FAILURE, "ifconfig_open"); + envformat = getenv("IFCONFIG_FORMAT"); if (envformat != NULL) setformat(envformat); @@ -691,6 +699,7 @@ main(int argc, char *argv[]) done: freeformat(); + ifconfig_close(lifh); exit(exit_code); } diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 67c25f5921d6..61b1137b47ba 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -36,6 +36,10 @@ * $FreeBSD$ */ +#pragma once + +#include + #define__constructor __attribute__((constructor)) struct afswtch; @@ -128,6 +132,7 @@ struct option { }; void opt_register(struct option *); +extern ifconfig_handle_t *lifh; extern struct ifreq ifr;
git: ebee42edc86c - stable/13 - sbin/ifconfig: Get media status with libifconfig
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=ebee42edc86c0864d4a9b09ae4dae32cca7a996f commit ebee42edc86c0864d4a9b09ae4dae32cca7a996f Author: Ryan Moeller AuthorDate: 2021-02-28 20:27:28 + Commit: Ryan Moeller CommitDate: 2021-03-19 13:00:40 + sbin/ifconfig: Get media status with libifconfig Code deduplication. Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D29030 (cherry picked from commit 2803fa471e77dc8f227fe00bbf075de7feb10022) --- sbin/ifconfig/ifconfig.h| 2 +- sbin/ifconfig/ifieee80211.c | 2 +- sbin/ifconfig/ifmedia.c | 673 3 files changed, 176 insertions(+), 501 deletions(-) diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 61b1137b47ba..ea541c5e9257 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -161,7 +161,7 @@ voidsfp_status(int s, struct ifreq *ifr, int verbose); * XXX expose this so modules that neeed to know of any pending * operations on ifmedia can avoid cmd line ordering confusion. */ -struct ifmediareq *ifmedia_getstate(int s); +struct ifmediareq *ifmedia_getstate(void); void print_vhid(const struct ifaddrs *, const char *); diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index bb406469829a..cfaf163f5930 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -239,7 +239,7 @@ getchaninfo(int s) if (get80211(s, IEEE80211_IOC_CHANINFO, chaninfo, IEEE80211_CHANINFO_SIZE(MAXCHAN)) < 0) err(1, "unable to get channel information"); - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); gethtconf(s); getvhtconf(s); } diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index cd3600df454c..66eb40254889 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -86,201 +86,103 @@ #include #include +#include + #include "ifconfig.h" -static voiddomediaopt(const char *, int, int); -static int get_media_subtype(int, const char *); -static int get_media_mode(int, const char *); -static int get_media_options(int, const char *); -static int lookup_media_word(struct ifmedia_description *, const char *); -static voidprint_media_word(int, int); -static voidprint_media_word_ifconfig(int); - -static struct ifmedia_description *get_toptype_desc(int); -static struct ifmedia_type_to_subtype *get_toptype_ttos(int); -static struct ifmedia_description *get_subtype_desc(int, -struct ifmedia_type_to_subtype *ttos); - -#defineIFM_OPMODE(x) \ - ((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \ -IFM_IEEE80211_IBSS | IFM_IEEE80211_WDS | IFM_IEEE80211_MONITOR | \ -IFM_IEEE80211_MBSS)) -#defineIFM_IEEE80211_STA 0 +static void domediaopt(const char *, bool, int); +static ifmedia_t get_media_subtype(ifmedia_t, const char *); +static ifmedia_t get_media_mode(ifmedia_t, const char *); +static ifmedia_t get_media_options(ifmedia_t, const char *); +static void print_media(ifmedia_t, bool); +static void print_media_ifconfig(ifmedia_t); static void media_status(int s) { - struct ifmediareq ifmr; - struct ifdownreason ifdr; - int *media_list, i; - bool no_carrier, xmedia; - - (void) memset(&ifmr, 0, sizeof(ifmr)); - (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); - xmedia = true; + struct ifmediareq *ifmr; - /* -* Check if interface supports extended media types. -*/ - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = false; - if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { - /* -* Interface doesn't support SIOC{G,S}IFMEDIA. -*/ + if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) return; - } - if (ifmr.ifm_count == 0) { + if (ifmr->ifm_count == 0) { warnx("%s: no media types?", name); - return; - } - - media_list = (int *)malloc(ifmr.ifm_count * sizeof(int)); - if (media_list == NULL) - err(1, "malloc"); - ifmr.ifm_ulist = media_list; - - if (xmedia) { - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFXMEDIA"); - } else { - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); + goto free; } printf("\tmedia: "); - print_media_word(ifmr.ifm_current, 1); - if (ifmr.ifm_active != ifmr.ifm_current) { + print_media(ifmr->ifm_current, true); + if (i
git: 534e161747f8 - stable/13 - libifconfig: Overhaul ifconfig_media_* interfaces
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=534e161747f80d6c972577a24b8ad22f6a5d60c4 commit 534e161747f80d6c972577a24b8ad22f6a5d60c4 Author: Ryan Moeller AuthorDate: 2021-03-02 10:29:17 + Commit: Ryan Moeller CommitDate: 2021-03-19 13:00:19 + libifconfig: Overhaul ifconfig_media_* interfaces Define an ifmedia_t type to use for ifmedia words. Add ifconfig_media_lookup_* functions to lookup ifmedia words by name. Get media options as an array of option names rather than formatting it as a comma-delimited list into a buffer. Sprinkle const on static the static description tables for peace of mind. Don't need to zero memory allocated by calloc. Reviewed by:kp Differential Revision: https://reviews.freebsd.org/D29029 (cherry picked from commit c4ba4aa547184ab401204096cdad9def4ab37964) --- lib/libifconfig/Makefile| 2 +- lib/libifconfig/Symbol.map | 9 +- lib/libifconfig/libifconfig.h | 69 +++- lib/libifconfig/libifconfig_media.c | 339 share/examples/libifconfig/status.c | 27 ++- 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 73dad36c1dc5..c6f006018427 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -7,7 +7,7 @@ INTERNALLIB=true LIBADD=m SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index 782f78ec5e34..b40f304915b3 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -26,12 +26,17 @@ FBSD_1.6 { ifconfig_lagg_get_lagg_status; ifconfig_lagg_get_laggport_status; ifconfig_list_cloners; + ifconfig_media_get_downreason; ifconfig_media_get_mediareq; - ifconfig_media_get_options_string; + ifconfig_media_get_mode; + ifconfig_media_get_options; ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; - ifconfig_media_get_downreason; + ifconfig_media_lookup_mode; + ifconfig_media_lookup_options; + ifconfig_media_lookup_subtype; + ifconfig_media_lookup_type; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index d8245ea13b23..e1cd6d1821a5 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -202,10 +202,73 @@ int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, */ int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, struct ifmediareq **ifmr); -const char *ifconfig_media_get_type(int ifmw); -const char *ifconfig_media_get_subtype(int ifmw); + const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); -void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); + +typedef int ifmedia_t; + +#define INVALID_IFMEDIA ((ifmedia_t)-1) + +/** Retrieve the name of a media type + * @param mediaThe media to be named + * @return A pointer to the media type name, or NULL on failure + */ +const char *ifconfig_media_get_type(ifmedia_t media); + +/** Retrieve a media type by its name + * @param name The name of a media type + * @return The media type value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_type(const char *name); + +/** Retrieve the name of a media subtype + * @param mediaThe media subtype to be named + * @return A pointer to the media subtype name, or NULL on failure + */ +const char *ifconfig_media_get_subtype(ifmedia_t media); + +/** Retrieve a media subtype by its name + * @param mediaThe top level media type whose subtype we want + * @param name The name of a media subtype + * @return The media subtype value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_subtype(ifmedia_t media, const char *name); + +/** Retrieve the name of a media mode + * @param mediaThe media mode to be named + * @return A pointer to the media mode name, or NULL on failure + */ +const char *ifconfig_media_get_mode(ifmedia_t media); + +/** Retrieve a media mode by its name + * @param mediaThe top level media type whose mode we want + * @param name The name of a media mode + * @return The media mode value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_mode(ifmedia_t media, const char *name); + +/** Retrieve an array of media options + * @param mediaThe media for which to obtain the options + * @return Pointer to an array of pointers to option names, + * terminated by a NULL pointer, or simply NULL on fa
git: b304cd9789ca - stable/12 - Drop EFI_STAGING_SIZE back down to 64M
The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b304cd9789ca7ff3df629af42a976450e8660a11 commit b304cd9789ca7ff3df629af42a976450e8660a11 Author: Warner Losh AuthorDate: 2020-12-17 17:02:09 + Commit: Ryan Moeller CommitDate: 2021-03-22 20:30:23 + Drop EFI_STAGING_SIZE back down to 64M vmware can't cope with anything larger than 64MB. Drop this back to 64MB everywhere but arm. PR: 251866 MFC After: 1 week (cherry picked from commit 4d6047edb675e52b8fad57135ab3ded8e66d0dac) --- stand/efi/loader/copy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 6499a44b9bbe..6ad673d62897 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -176,9 +176,7 @@ out: #endif /* __i386__ || __amd64__ */ #ifndef EFI_STAGING_SIZE -#if defined(__amd64__) -#defineEFI_STAGING_SIZE100 -#elif defined(__arm__) +#if defined(__arm__) #defineEFI_STAGING_SIZE32 #else #defineEFI_STAGING_SIZE64 ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
Re: git: b304cd9789ca - stable/12 - Drop EFI_STAGING_SIZE back down to 64M
On 3/22/21 6:08 PM, Maxim Sobolev wrote: Hmm, that's really annoying, reminiscent of the old DOS days, where you might have few megs of memory, but won't be able to use it due to some bios/motherboard quirk. :-/ Can we at least have some specific section for VMWare to teak that in? We already have the HYPER-V section in that file, so it's not unheard of. At the very least other virtual machines (i.e. VirtualBox in the EFI mode or majority "real" EFI servers) do not have this restriction. My understanding is that the staging area will dynamically grow at run time if necessary: https://cgit.freebsd.org/src/commit/?id=821e3395c053a35e666c99c94bbeed84f7da2dcf - Ryan ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: efad9c8ba3ce - main - align nfsdumpstate column output
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=efad9c8ba3cec7f6e39b128b90afab70701fd8d9 commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9 Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 + Commit: Ryan Moeller CommitDate: 2021-03-24 20:33:41 + align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by:sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: badcfbacf384 - main - rpc.lockd: Unconditionally close fds as daemon
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=badcfbacf3840a4097bb79192054481c7674e7d2 commit badcfbacf3840a4097bb79192054481c7674e7d2 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 + Commit: Ryan Moeller CommitDate: 2021-03-26 18:05:33 + rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: b07b7aec6534 - main - bsdinstall: Drop vestigial bsdinstall-esps cleanup
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b07b7aec6534052d60cffe010c0426a7ab986d85 commit b07b7aec6534052d60cffe010c0426a7ab986d85 Author: Ryan Moeller AuthorDate: 2021-03-26 18:12:18 + Commit: Ryan Moeller CommitDate: 2021-03-26 18:12:18 + bsdinstall: Drop vestigial bsdinstall-esps cleanup This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2. MFC after: 3 days Sponsored by: iXsystems, Inc. Reviewed by:imp Differential Revision: https://reviews.freebsd.org/D29325 --- usr.sbin/bsdinstall/partedit/partedit.c | 14 +- usr.sbin/bsdinstall/partedit/partedit.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 6d045428dd32..84f7ef032ba9 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -45,7 +45,6 @@ #include "partedit.h" struct pmetadata_head part_metadata; -int tmpdfd; static int sade_mode = 0; static int apply_changes(struct gmesh *mesh); @@ -69,8 +68,6 @@ sigint_handler(int sig) end_dialog(); - close(tmpdfd); - exit(1); } @@ -78,7 +75,7 @@ int main(int argc, const char **argv) { struct partition_metadata *md; - const char *progname, *prompt, *tmpdir; + const char *progname, *prompt; struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; @@ -90,14 +87,6 @@ main(int argc, const char **argv) TAILQ_INIT(&part_metadata); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL) - tmpdir = "/tmp"; - tmpdfd = open(tmpdir, O_DIRECTORY); - if (tmpdfd < 0) - err(EX_OSERR, "%s", tmpdir); - unlinkat(tmpdfd, "bsdinstall-esps", 0); - init_fstab_metadata(); init_dialog(stdin, stdout); @@ -233,7 +222,6 @@ main(int argc, const char **argv) geom_deletetree(&mesh); free(items); end_dialog(); - close(tmpdfd); return (error); } diff --git a/usr.sbin/bsdinstall/partedit/partedit.h b/usr.sbin/bsdinstall/partedit/partedit.h index 20d2047c1408..5c0405922d21 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.h +++ b/usr.sbin/bsdinstall/partedit/partedit.h @@ -39,8 +39,6 @@ struct gprovider; struct gmesh; struct ggeom; -extern int tmpdfd; - TAILQ_HEAD(pmetadata_head, partition_metadata); extern struct pmetadata_head part_metadata; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: b92b2ffd1233 - stable/13 - align nfsdumpstate column output
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b92b2ffd1233d9513dfcbb412c2bb578eef70e05 commit b92b2ffd1233d9513dfcbb412c2bb578eef70e05 Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 + Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:14 + align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by:sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: af68f5380642 - stable/13 - rpc.lockd: Unconditionally close fds as daemon
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=af68f5380642b3beb7be25cdacd73848f9c680e3 commit af68f5380642b3beb7be25cdacd73848f9c680e3 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 + Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:35 + rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 16443ffd4108 - stable/13 - bsdinstall: Drop vestigial bsdinstall-esps cleanup
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=16443ffd4108bed3c290fee90d7337ba6877bb3e commit 16443ffd4108bed3c290fee90d7337ba6877bb3e Author: Ryan Moeller AuthorDate: 2021-03-26 18:12:18 + Commit: Ryan Moeller CommitDate: 2021-03-29 13:34:12 + bsdinstall: Drop vestigial bsdinstall-esps cleanup This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2. MFC after: 3 days Sponsored by: iXsystems, Inc. Reviewed by:imp Differential Revision: https://reviews.freebsd.org/D29325 (cherry picked from commit b07b7aec6534052d60cffe010c0426a7ab986d85) --- usr.sbin/bsdinstall/partedit/partedit.c | 14 +- usr.sbin/bsdinstall/partedit/partedit.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 6d045428dd32..84f7ef032ba9 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -45,7 +45,6 @@ #include "partedit.h" struct pmetadata_head part_metadata; -int tmpdfd; static int sade_mode = 0; static int apply_changes(struct gmesh *mesh); @@ -69,8 +68,6 @@ sigint_handler(int sig) end_dialog(); - close(tmpdfd); - exit(1); } @@ -78,7 +75,7 @@ int main(int argc, const char **argv) { struct partition_metadata *md; - const char *progname, *prompt, *tmpdir; + const char *progname, *prompt; struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; @@ -90,14 +87,6 @@ main(int argc, const char **argv) TAILQ_INIT(&part_metadata); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL) - tmpdir = "/tmp"; - tmpdfd = open(tmpdir, O_DIRECTORY); - if (tmpdfd < 0) - err(EX_OSERR, "%s", tmpdir); - unlinkat(tmpdfd, "bsdinstall-esps", 0); - init_fstab_metadata(); init_dialog(stdin, stdout); @@ -233,7 +222,6 @@ main(int argc, const char **argv) geom_deletetree(&mesh); free(items); end_dialog(); - close(tmpdfd); return (error); } diff --git a/usr.sbin/bsdinstall/partedit/partedit.h b/usr.sbin/bsdinstall/partedit/partedit.h index e989decc2359..1dccc653aea1 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.h +++ b/usr.sbin/bsdinstall/partedit/partedit.h @@ -39,8 +39,6 @@ struct gprovider; struct gmesh; struct ggeom; -extern int tmpdfd; - TAILQ_HEAD(pmetadata_head, partition_metadata); extern struct pmetadata_head part_metadata; ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 57593b2bca76 - stable/12 - align nfsdumpstate column output
The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=57593b2bca76db683ec6c589c1b051132181d55b commit 57593b2bca76db683ec6c589c1b051132181d55b Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 + Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:06 + align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by:sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 4fd5354e85e4 - stable/12 - rpc.lockd: Unconditionally close fds as daemon
The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4fd5354e85e4e72b91e7690595173b3bbde21490 commit 4fd5354e85e4e72b91e7690595173b3bbde21490 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 + Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:16 + rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: a42a0b77f0de - stable/11 - Fix array out of bound panic introduced in r306219.
The branch stable/11 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=a42a0b77f0de636a91f79fa2fde8a507d88b79b7 commit a42a0b77f0de636a91f79fa2fde8a507d88b79b7 Author: Alexander Motin AuthorDate: 2019-05-28 18:32:04 + Commit: Ryan Moeller CommitDate: 2021-03-30 15:02:24 + Fix array out of bound panic introduced in r306219. As I see, different NICs in different configurations may have different numbers of TX and RX queues. The code was assuming 1:1 mapping between event queues (interrupts) and TX/RX queues. Since number of interrupts is set to maximum of TX and RX queues, when those two are different, the system is doomed. I have no documentation or deep knowledge about this hardware, so this change is based on general observations and code reading. If some of my guesses are wrong, please do better. I just confirmed HP NC550SFP NICs are working now. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 3582828053556ca0e05ed9aab3e78008a0595e09) --- sys/dev/oce/oce_if.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 1de38d4528fc..362bc1776890 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -2395,10 +2395,20 @@ oce_eqd_set_periodic(POCE_SOFTC sc) goto modify_eqd; } - rq = sc->rq[i]; - rxpkts = rq->rx_stats.rx_pkts; - wq = sc->wq[i]; - tx_reqs = wq->tx_stats.tx_reqs; + if (i == 0) { + rq = sc->rq[0]; + rxpkts = rq->rx_stats.rx_pkts; + } else + rxpkts = 0; + if (i + 1 < sc->nrqs) { + rq = sc->rq[i + 1]; + rxpkts += rq->rx_stats.rx_pkts; + } + if (i < sc->nwqs) { + wq = sc->wq[i]; + tx_reqs = wq->tx_stats.tx_reqs; + } else + tx_reqs = 0; now = ticks; if (!aic->ticks || now < aic->ticks || ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 407fb44c920a - main - ifconfig: Reuse media state in ifmedia_getstate
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=407fb44c920a580a30dfe7d1add796a7b35a5ac7 commit 407fb44c920a580a30dfe7d1add796a7b35a5ac7 Author: Ryan Moeller AuthorDate: 2021-04-16 02:32:25 + Commit: Ryan Moeller CommitDate: 2021-04-16 02:32:25 + ifconfig: Reuse media state in ifmedia_getstate This restores behavior lost in code cleanup, fixing a regression after 2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options only applies some of the changes, not all. Reported by:np Reviewed by:donner MFC after: immediately Differential Revision: https://reviews.freebsd.org/D29741 --- sbin/ifconfig/ifmedia.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index 66eb40254889..aacf34a13248 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -159,7 +159,10 @@ free: struct ifmediareq * ifmedia_getstate(void) { - static struct ifmediareq *ifmr; + static struct ifmediareq *ifmr = NULL; + + if (ifmr != NULL) + return (ifmr); if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) errc(1, ifconfig_err_errno(lifh), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 1310ff46bf39 - stable/13 - ifconfig: Reuse media state in ifmedia_getstate
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=1310ff46bf39ee27873eba67fb4aeaf2917bab3d commit 1310ff46bf39ee27873eba67fb4aeaf2917bab3d Author: Ryan Moeller AuthorDate: 2021-04-16 02:32:25 + Commit: Ryan Moeller CommitDate: 2021-04-16 02:42:45 + ifconfig: Reuse media state in ifmedia_getstate This restores behavior lost in code cleanup, fixing a regression after 2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options only applies some of the changes, not all. Reported by:np Reviewed by:donner Differential Revision: https://reviews.freebsd.org/D29741 (cherry picked from commit 407fb44c920a580a30dfe7d1add796a7b35a5ac7) --- sbin/ifconfig/ifmedia.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index 66eb40254889..aacf34a13248 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -159,7 +159,10 @@ free: struct ifmediareq * ifmedia_getstate(void) { - static struct ifmediareq *ifmr; + static struct ifmediareq *ifmr = NULL; + + if (ifmr != NULL) + return (ifmr); if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) errc(1, ifconfig_err_errno(lifh), ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: dd559118ab3f - main - Fix leak in libc NFSv4 flags parsing
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=dd559118ab3f065ae230b324c3fe4bb1c9b7ca56 commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56 Author: Andrew Walker AuthorDate: 2021-04-20 19:34:44 + Commit: Ryan Moeller CommitDate: 2021-04-20 19:39:56 + Fix leak in libc NFSv4 flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker Reported by:valgrind Reviewed by:allanjude, freqlabs, rpokala MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 --- lib/libc/posix1e/acl_support_nfs4.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index 3962eaa6daa8..92ec666b2313 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -142,9 +142,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -166,12 +167,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 89c3c32647a5 - main - bhyve: Gracefully handle virtio-scsi with no conf
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=89c3c32647a5099b297af2958e5a939eff0c0ce0 commit 89c3c32647a5099b297af2958e5a939eff0c0ce0 Author: Ryan Moeller AuthorDate: 2021-04-22 16:06:08 + Commit: Ryan Moeller CommitDate: 2021-04-22 16:06:08 + bhyve: Gracefully handle virtio-scsi with no conf Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used by some third party software to probe bhyve for virtio-scsi support. Reviewed by:jhb MFC after: 1 day Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29926 --- usr.sbin/bhyve/pci_virtio_scsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index aed2fe2dbb23..e8124b9b3441 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -662,6 +662,9 @@ pci_vtscsi_legacy_config(nvlist_t *nvl, const char *opts) { char *cp, *devname; + if (opts == NULL) + return (0); + cp = strchr(opts, ','); if (cp == NULL) { set_config_value_node(nvl, "dev", opts); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 8845eea6e288 - stable/13 - Fix leak in libc NFSv4 ACL flags parsing
The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=8845eea6e288e96e7114f41fb3d8e25aae810a2d commit 8845eea6e288e96e7114f41fb3d8e25aae810a2d Author: Andrew Walker AuthorDate: 2021-04-20 19:34:44 + Commit: Ryan Moeller CommitDate: 2021-04-23 10:41:23 + Fix leak in libc NFSv4 ACL flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker Reported by:valgrind Reviewed by:allanjude, freqlabs, rpokala Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 (cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56) --- lib/libc/posix1e/acl_support_nfs4.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index 3962eaa6daa8..92ec666b2313 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -142,9 +142,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -166,12 +167,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 7b61f67f398a - stable/12 - Fix leak in libc NFSv4 ACL flags parsing
The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=7b61f67f398ab589f629ee7c4ea705d65d700630 commit 7b61f67f398ab589f629ee7c4ea705d65d700630 Author: Andrew Walker AuthorDate: 2021-04-20 19:34:44 + Commit: Ryan Moeller CommitDate: 2021-04-23 10:42:37 + Fix leak in libc NFSv4 ACL flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker Reported by:valgrind Reviewed by:allanjude, freqlabs, rpokala Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 (cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56) --- lib/libc/posix1e/acl_support_nfs4.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index fe6f6f69cf21..845db5cc7b28 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -143,9 +143,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -167,12 +168,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 550fcd830db7 - stable/11 - Fix leak in libc NFSv4 ACL flags parsing
The branch stable/11 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=550fcd830db7e8d644795e5fc9bd83ef4604a1c1 commit 550fcd830db7e8d644795e5fc9bd83ef4604a1c1 Author: Andrew Walker AuthorDate: 2021-04-20 19:34:44 + Commit: Ryan Moeller CommitDate: 2021-04-23 10:43:51 + Fix leak in libc NFSv4 ACL flags parsing Free memory allocated by strdup() in parse_flags_verbose(). Submitted by: Andrew Walker Reported by:valgrind Reviewed by:allanjude, freqlabs, rpokala Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29871 (cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56) --- lib/libc/posix1e/acl_support_nfs4.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c index 7dd7f04daaf3..ffed4446c1b2 100644 --- a/lib/libc/posix1e/acl_support_nfs4.c +++ b/lib/libc/posix1e/acl_support_nfs4.c @@ -141,9 +141,10 @@ parse_flags_verbose(const char *strp, uint32_t *var, int *try_compact) { int i, found, ever_found = 0; - char *str, *flag; + char *str, *flag, *to_free; str = strdup(strp); + to_free = str; *try_compact = 0; *var = 0; @@ -165,12 +166,12 @@ parse_flags_verbose(const char *strp, uint32_t *var, "invalid flag \"%s\"", flags_name, flag); else *try_compact = 1; - free(str); + free(to_free); return (-1); } } - free(str); + free(to_free); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: b252fb24301c - main - bhyve: ahci: Fix regression with no ports
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b252fb24301c1f7e7d83eab631e7d9fa947e227d commit b252fb24301c1f7e7d83eab631e7d9fa947e227d Author: Ryan Moeller AuthorDate: 2022-01-21 12:59:25 + Commit: Ryan Moeller CommitDate: 2022-01-21 12:59:25 + bhyve: ahci: Fix regression with no ports An AHCI controller may be specified with no connected ports. Avoid dumping core in this case for compatibility with existing VM configs. Reviewed by:khng, jhb Fixes: 621b5090487de Refactor configuration management in bhyve. MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D33969 --- usr.sbin/bhyve/pci_ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 316fbcf0f18d..d07b1f085e3d 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -2440,7 +2440,7 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) slots = 32; ports_nvl = find_relative_config_node(nvl, "port"); - for (p = 0; p < MAX_PORTS; p++) { + for (p = 0; ports_nvl != NULL && p < MAX_PORTS; p++) { struct ata_params *ata_ident = &sc->port[p].ata_ident; char ident[AHCI_PORT_IDENT];
git: 47e46b1123b9 - main - zfs: Fix zvol_cdev_open locking
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=47e46b1123b9c732c366848e8184ce42e086a0fb commit 47e46b1123b9c732c366848e8184ce42e086a0fb Author: Ryan Moeller AuthorDate: 2022-01-26 18:33:23 + Commit: Ryan Moeller CommitDate: 2022-01-26 18:37:52 + zfs: Fix zvol_cdev_open locking First open locking changes were correctly applied to zvol_geom_open but incorrectly applied to zvol_cdev_open, causing spa_namespace_lock to be held indefinitely. Make the first open locking in zvol_cdev_open match zvol_geom_open. This change has been accepted upstream in openzfs/zfs#13016 but is not yet merged. Reviewed by:mav Fixes: e92ffd9b6268 Sponsored by: iXsystems, Inc. --- sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c index 8785557cb61d..06dd8cfdd790 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c @@ -928,8 +928,8 @@ retry: */ if (!mutex_owned(&spa_namespace_lock)) { if (!mutex_tryenter(&spa_namespace_lock)) { - rw_exit(&zvol_state_lock); - mutex_enter(&spa_namespace_lock); + mutex_exit(&zv->zv_state_lock); + rw_exit(&zv->zv_suspend_lock); kern_yield(PRI_USER); goto retry; } else {