From owner-svn-src-stable-11@freebsd.org Mon Apr 6 06:38:55 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682732A462A; Mon, 6 Apr 2020 06:38:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wgqM226yz4ZW0; Mon, 6 Apr 2020 06:38:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40C8C23AB2; Mon, 6 Apr 2020 06:38:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0366ct3u096149; Mon, 6 Apr 2020 06:38:55 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0366csuU096146; Mon, 6 Apr 2020 06:38:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004060638.0366csuU096146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 6 Apr 2020 06:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359649 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 359649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 06:38:55 -0000 Author: ae Date: Mon Apr 6 06:38:54 2020 New Revision: 359649 URL: https://svnweb.freebsd.org/changeset/base/359649 Log: MFC r359271: Use IP_FW_NAT44_DESTROY opcode for IP_FW3 socket option to destroy NAT instance. The NAT44 group of opcodes for IP_FW3 socket option is modern way to control NAT instances and this method can be used in future to switch from numeric to named NAT instances, like was done for ipfw tables. The IP_FW_NAT_DEL opcode is the last remnant of old ipfw_ctl control plane that doesn't support versioned operations. This interface will be retired soon. Modified: stable/11/sbin/ipfw/ipfw2.c stable/11/sbin/ipfw/ipfw2.h stable/11/sbin/ipfw/nat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw2.c ============================================================================== --- stable/11/sbin/ipfw/ipfw2.c Mon Apr 6 06:34:45 2020 (r359648) +++ stable/11/sbin/ipfw/ipfw2.c Mon Apr 6 06:38:54 2020 (r359649) @@ -3328,13 +3328,7 @@ ipfw_delete(char *av[]) j = strtol(sep + 1, NULL, 10); av++; if (co.do_nat) { - exitval = do_cmd(IP_FW_NAT_DEL, &i, sizeof i); - if (exitval) { - exitval = EX_UNAVAILABLE; - if (co.do_quiet) - continue; - warn("nat %u not available", i); - } + exitval = ipfw_delete_nat(i); } else if (co.do_pipe) { exitval = ipfw_delete_pipe(co.do_pipe, i); } else { Modified: stable/11/sbin/ipfw/ipfw2.h ============================================================================== --- stable/11/sbin/ipfw/ipfw2.h Mon Apr 6 06:34:45 2020 (r359648) +++ stable/11/sbin/ipfw/ipfw2.h Mon Apr 6 06:38:54 2020 (r359649) @@ -384,6 +384,7 @@ extern int resvd_set_number; /* first-level command handlers */ void ipfw_add(char *av[]); void ipfw_show_nat(int ac, char **av); +int ipfw_delete_nat(int i); void ipfw_config_pipe(int ac, char **av); void ipfw_config_nat(int ac, char **av); void ipfw_sets_handler(char *av[]); Modified: stable/11/sbin/ipfw/nat.c ============================================================================== --- stable/11/sbin/ipfw/nat.c Mon Apr 6 06:34:45 2020 (r359648) +++ stable/11/sbin/ipfw/nat.c Mon Apr 6 06:38:54 2020 (r359649) @@ -931,6 +931,34 @@ ipfw_config_nat(int ac, char **av) } } +static void +nat_fill_ntlv(ipfw_obj_ntlv *ntlv, int i) +{ + + ntlv->head.type = IPFW_TLV_EACTION_NAME(1); /* it doesn't matter */ + ntlv->head.length = sizeof(ipfw_obj_ntlv); + ntlv->idx = 1; + ntlv->set = 0; /* not yet */ + snprintf(ntlv->name, sizeof(ntlv->name), "%d", i); +} + +int +ipfw_delete_nat(int i) +{ + ipfw_obj_header oh; + int ret; + + memset(&oh, 0, sizeof(oh)); + nat_fill_ntlv(&oh.ntlv, i); + ret = do_set3(IP_FW_NAT44_DESTROY, &oh.opheader, sizeof(oh)); + if (ret == -1) { + if (!co.do_quiet) + warn("nat %u not available", i); + return (EX_UNAVAILABLE); + } + return (EX_OK); +} + struct nat_list_arg { uint16_t cmd; int is_all; From owner-svn-src-stable-11@freebsd.org Mon Apr 6 07:09:04 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E33FA2A51EE; Mon, 6 Apr 2020 07:09:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48whV850cCz4bsn; Mon, 6 Apr 2020 07:09:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A68892406E; Mon, 6 Apr 2020 07:09:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036794PL014507; Mon, 6 Apr 2020 07:09:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036794fN014506; Mon, 6 Apr 2020 07:09:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004060709.036794fN014506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Apr 2020 07:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359651 - stable/11/sys/fs/cuse X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/fs/cuse X-SVN-Commit-Revision: 359651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 07:09:05 -0000 Author: hselasky Date: Mon Apr 6 07:09:04 2020 New Revision: 359651 URL: https://svnweb.freebsd.org/changeset/base/359651 Log: MFC r359452: Fine grain locking inside the cuse(3) kernel module. Implement one mutex per cuse(3) server instance which also cover the clients belonging to the given server instance. This should significantly reduce the mutex congestion inside the cuse(3) kernel module when multiple servers are in use. Sponsored by: Mellanox Technologies Modified: stable/11/sys/fs/cuse/cuse.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/cuse/cuse.c ============================================================================== --- stable/11/sys/fs/cuse/cuse.c Mon Apr 6 07:07:27 2020 (r359650) +++ stable/11/sys/fs/cuse/cuse.c Mon Apr 6 07:09:04 2020 (r359651) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2010-2017 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2010-2020 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -116,6 +116,7 @@ struct cuse_server { TAILQ_HEAD(, cuse_server_dev) hdev; TAILQ_HEAD(, cuse_client) hcli; TAILQ_HEAD(, cuse_memory) hmem; + struct mtx mtx; struct cv cv; struct selinfo selinfo; pid_t pid; @@ -147,7 +148,7 @@ struct cuse_client { static MALLOC_DEFINE(M_CUSE, "cuse", "CUSE memory"); static TAILQ_HEAD(, cuse_server) cuse_server_head; -static struct mtx cuse_mtx; +static struct mtx cuse_global_mtx; static struct cdev *cuse_dev; static struct cuse_server *cuse_alloc_unit[CUSE_DEVICES_MAX]; static int cuse_alloc_unit_id[CUSE_DEVICES_MAX]; @@ -218,18 +219,30 @@ static void cuse_client_is_closing(struct cuse_client static int cuse_free_unit_by_id_locked(struct cuse_server *, int); static void -cuse_lock(void) +cuse_global_lock(void) { - mtx_lock(&cuse_mtx); + mtx_lock(&cuse_global_mtx); } static void -cuse_unlock(void) +cuse_global_unlock(void) { - mtx_unlock(&cuse_mtx); + mtx_unlock(&cuse_global_mtx); } static void +cuse_server_lock(struct cuse_server *pcs) +{ + mtx_lock(&pcs->mtx); +} + +static void +cuse_server_unlock(struct cuse_server *pcs) +{ + mtx_unlock(&pcs->mtx); +} + +static void cuse_cmd_lock(struct cuse_client_command *pccmd) { sx_xlock(&pccmd->sx); @@ -246,7 +259,7 @@ cuse_kern_init(void *arg) { TAILQ_INIT(&cuse_server_head); - mtx_init(&cuse_mtx, "cuse-mtx", NULL, MTX_DEF); + mtx_init(&cuse_global_mtx, "cuse-global-mtx", NULL, MTX_DEF); cuse_dev = make_dev(&cuse_server_devsw, 0, UID_ROOT, GID_OPERATOR, 0600, "cuse"); @@ -269,9 +282,9 @@ cuse_kern_uninit(void *arg) pause("DRAIN", 2 * hz); - cuse_lock(); + cuse_global_lock(); ptr = TAILQ_FIRST(&cuse_server_head); - cuse_unlock(); + cuse_global_unlock(); if (ptr == NULL) break; @@ -280,7 +293,7 @@ cuse_kern_uninit(void *arg) if (cuse_dev != NULL) destroy_dev(cuse_dev); - mtx_destroy(&cuse_mtx); + mtx_destroy(&cuse_global_mtx); } SYSUNINIT(cuse_kern_uninit, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_uninit, 0); @@ -295,14 +308,10 @@ cuse_server_get(struct cuse_server **ppcs) *ppcs = NULL; return (error); } - /* check if closing */ - cuse_lock(); if (pcs->is_closing) { - cuse_unlock(); *ppcs = NULL; return (EINVAL); } - cuse_unlock(); *ppcs = pcs; return (0); } @@ -428,14 +437,14 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint goto error_0; } - cuse_lock(); + cuse_server_lock(pcs); /* check if allocation number already exists */ TAILQ_FOREACH(temp, &pcs->hmem, entry) { if (temp->alloc_nr == alloc_nr) break; } if (temp != NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); error = EBUSY; goto error_1; } @@ -443,7 +452,7 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint mem->page_count = page_count; mem->alloc_nr = alloc_nr; TAILQ_INSERT_TAIL(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); return (0); @@ -459,17 +468,17 @@ cuse_server_free_memory(struct cuse_server *pcs, uint3 { struct cuse_memory *mem; - cuse_lock(); + cuse_server_lock(pcs); TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } TAILQ_REMOVE(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_vm_memory_free(mem); @@ -488,14 +497,10 @@ cuse_client_get(struct cuse_client **ppcc) *ppcc = NULL; return (error); } - /* check if closing */ - cuse_lock(); if (CUSE_CLIENT_CLOSING(pcc) || pcc->server->is_closing) { - cuse_unlock(); *ppcc = NULL; return (EINVAL); } - cuse_unlock(); *ppcc = pcc; return (0); } @@ -580,28 +585,28 @@ static int cuse_client_receive_command_locked(struct cuse_client_command *pccmd, uint8_t *arg_ptr, uint32_t arg_len) { + struct cuse_server *pcs; int error; + pcs = pccmd->client->server; error = 0; pccmd->proc_curr = curthread->td_proc; - if (CUSE_CLIENT_CLOSING(pccmd->client) || - pccmd->client->server->is_closing) { + if (CUSE_CLIENT_CLOSING(pccmd->client) || pcs->is_closing) { error = CUSE_ERR_OTHER; goto done; } while (pccmd->command == CUSE_CMD_NONE) { if (error != 0) { - cv_wait(&pccmd->cv, &cuse_mtx); + cv_wait(&pccmd->cv, &pcs->mtx); } else { - error = cv_wait_sig(&pccmd->cv, &cuse_mtx); + error = cv_wait_sig(&pccmd->cv, &pcs->mtx); if (error != 0) cuse_client_got_signal(pccmd); } - if (CUSE_CLIENT_CLOSING(pccmd->client) || - pccmd->client->server->is_closing) { + if (CUSE_CLIENT_CLOSING(pccmd->client) || pcs->is_closing) { error = CUSE_ERR_OTHER; goto done; } @@ -618,7 +623,7 @@ done: pccmd->proc_curr = NULL; while (pccmd->proc_refs != 0) - cv_wait(&pccmd->cv, &cuse_mtx); + cv_wait(&pccmd->cv, &pcs->mtx); return (error); } @@ -637,7 +642,7 @@ cuse_server_free_dev(struct cuse_server_dev *pcsd) pcs = pcsd->server; /* prevent creation of more devices */ - cuse_lock(); + cuse_server_lock(pcs); if (pcsd->kern_dev != NULL) pcsd->kern_dev->si_drv1 = NULL; @@ -645,7 +650,7 @@ cuse_server_free_dev(struct cuse_server_dev *pcsd) if (pcc->server_dev == pcsd) cuse_client_is_closing(pcc); } - cuse_unlock(); + cuse_server_unlock(pcs); /* destroy device, if any */ if (pcsd->kern_dev != NULL) { @@ -661,43 +666,46 @@ cuse_server_unref(struct cuse_server *pcs) struct cuse_server_dev *pcsd; struct cuse_memory *mem; - cuse_lock(); - pcs->refs--; - if (pcs->refs != 0) { - cuse_unlock(); + cuse_server_lock(pcs); + if (--(pcs->refs) != 0) { + cuse_server_unlock(pcs); return; } cuse_server_is_closing(pcs); /* final client wakeup, if any */ cuse_server_wakeup_all_client_locked(pcs); + cuse_global_lock(); TAILQ_REMOVE(&cuse_server_head, pcs, entry); + cuse_global_unlock(); while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_server_free_dev(pcsd); - cuse_lock(); + cuse_server_lock(pcs); } cuse_free_unit_by_id_locked(pcs, -1); while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) { TAILQ_REMOVE(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_vm_memory_free(mem); - cuse_lock(); + cuse_server_lock(pcs); } knlist_clear(&pcs->selinfo.si_note, 1); knlist_destroy(&pcs->selinfo.si_note); - cuse_unlock(); + cuse_server_unlock(pcs); seldrain(&pcs->selinfo); cv_destroy(&pcs->cv); + mtx_destroy(&pcs->mtx); + free(pcs, M_CUSE); } @@ -706,7 +714,7 @@ cuse_server_do_close(struct cuse_server *pcs) { int retval; - cuse_lock(); + cuse_server_lock(pcs); cuse_server_is_closing(pcs); /* final client wakeup, if any */ cuse_server_wakeup_all_client_locked(pcs); @@ -714,7 +722,7 @@ cuse_server_do_close(struct cuse_server *pcs) knlist_clear(&pcs->selinfo.si_note, 1); retval = pcs->refs; - cuse_unlock(); + cuse_server_unlock(pcs); return (retval); } @@ -760,12 +768,14 @@ cuse_server_open(struct cdev *dev, int fflags, int dev cv_init(&pcs->cv, "cuse-server-cv"); - knlist_init_mtx(&pcs->selinfo.si_note, &cuse_mtx); + mtx_init(&pcs->mtx, "cuse-server-mtx", NULL, MTX_DEF); - cuse_lock(); + knlist_init_mtx(&pcs->selinfo.si_note, &pcs->mtx); + + cuse_global_lock(); pcs->refs++; TAILQ_INSERT_TAIL(&cuse_server_head, pcs, entry); - cuse_unlock(); + cuse_global_unlock(); return (0); } @@ -794,7 +804,8 @@ cuse_server_write(struct cdev *dev, struct uio *uio, i } static int -cuse_server_ioctl_copy_locked(struct cuse_client_command *pccmd, +cuse_server_ioctl_copy_locked(struct cuse_server *pcs, + struct cuse_client_command *pccmd, struct cuse_data_chunk *pchk, int isread) { struct proc *p_proc; @@ -821,7 +832,7 @@ cuse_server_ioctl_copy_locked(struct cuse_client_comma pccmd->proc_refs++; - cuse_unlock(); + cuse_server_unlock(pcs); if (isread == 0) { error = copyin( @@ -835,7 +846,7 @@ cuse_server_ioctl_copy_locked(struct cuse_client_comma pchk->length); } - cuse_lock(); + cuse_server_lock(pcs); pccmd->proc_refs--; @@ -900,7 +911,8 @@ cuse_proc2proc_copy(struct proc *proc_s, vm_offset_t d } static int -cuse_server_data_copy_locked(struct cuse_client_command *pccmd, +cuse_server_data_copy_locked(struct cuse_server *pcs, + struct cuse_client_command *pccmd, struct cuse_data_chunk *pchk, int isread) { struct proc *p_proc; @@ -915,7 +927,7 @@ cuse_server_data_copy_locked(struct cuse_client_comman pccmd->proc_refs++; - cuse_unlock(); + cuse_server_unlock(pcs); if (isread == 0) { error = cuse_proc2proc_copy( @@ -929,7 +941,7 @@ cuse_server_data_copy_locked(struct cuse_client_comman pchk->length); } - cuse_lock(); + cuse_server_lock(pcs); pccmd->proc_refs--; @@ -1033,16 +1045,16 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_GET_COMMAND: pcmd = (void *)data; - cuse_lock(); + cuse_server_lock(pcs); while ((pccmd = TAILQ_FIRST(&pcs->head)) == NULL) { - error = cv_wait_sig(&pcs->cv, &cuse_mtx); + error = cv_wait_sig(&pcs->cv, &pcs->mtx); if (pcs->is_closing) error = ENXIO; if (error) { - cuse_unlock(); + cuse_server_unlock(pcs); return (error); } } @@ -1054,13 +1066,13 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, *pcmd = pccmd->sub; - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_SYNC_COMMAND: - cuse_lock(); + cuse_server_lock(pcs); while ((pccmd = cuse_server_find_command(pcs, curthread)) != NULL) { /* send sync command */ @@ -1071,16 +1083,16 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, /* signal peer, if any */ cv_signal(&pccmd->cv); } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_ALLOC_UNIT: - cuse_lock(); + cuse_server_lock(pcs); n = cuse_alloc_unit_by_id_locked(pcs, CUSE_ID_DEFAULT(0)); - cuse_unlock(); + cuse_server_unlock(pcs); if (n < 0) error = ENOMEM; @@ -1094,9 +1106,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, n = (n & CUSE_ID_MASK); - cuse_lock(); + cuse_server_lock(pcs); n = cuse_alloc_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); if (n < 0) error = ENOMEM; @@ -1110,18 +1122,18 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, n = CUSE_ID_DEFAULT(n); - cuse_lock(); + cuse_server_lock(pcs); error = cuse_free_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_FREE_UNIT_BY_ID: n = *(int *)data; - cuse_lock(); + cuse_server_lock(pcs); error = cuse_free_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_ALLOC_MEMORY: @@ -1152,7 +1164,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_GET_SIG: - cuse_lock(); + cuse_server_lock(pcs); pccmd = cuse_server_find_command(pcs, curthread); if (pccmd != NULL) { @@ -1161,7 +1173,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else { n = 0; } - cuse_unlock(); + cuse_server_unlock(pcs); *(int *)data = n; @@ -1169,7 +1181,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_SET_PFH: - cuse_lock(); + cuse_server_lock(pcs); pccmd = cuse_server_find_command(pcs, curthread); if (pccmd != NULL) { @@ -1180,7 +1192,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else { error = ENXIO; } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_CREATE_DEV: @@ -1226,9 +1238,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } pcsd->kern_dev->si_drv1 = pcsd; - cuse_lock(); + cuse_server_lock(pcs); TAILQ_INSERT_TAIL(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); break; @@ -1238,7 +1250,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, if (error) break; - cuse_lock(); + cuse_server_lock(pcs); error = EINVAL; @@ -1246,9 +1258,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, while (pcsd != NULL) { if (pcsd->user_dev == *(struct cuse_dev **)data) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_server_free_dev(pcsd); - cuse_lock(); + cuse_server_lock(pcs); error = 0; pcsd = TAILQ_FIRST(&pcs->hdev); } else { @@ -1256,13 +1268,13 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_WRITE_DATA: case CUSE_IOCTL_READ_DATA: - cuse_lock(); + cuse_server_lock(pcs); pchk = (struct cuse_data_chunk *)data; pccmd = cuse_server_find_command(pcs, curthread); @@ -1272,23 +1284,23 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else if (pchk->peer_ptr < CUSE_BUF_MIN_PTR) { error = EFAULT; /* NULL pointer */ } else if (pchk->peer_ptr < CUSE_BUF_MAX_PTR) { - error = cuse_server_ioctl_copy_locked(pccmd, + error = cuse_server_ioctl_copy_locked(pcs, pccmd, pchk, cmd == CUSE_IOCTL_READ_DATA); } else { - error = cuse_server_data_copy_locked(pccmd, + error = cuse_server_data_copy_locked(pcs, pccmd, pchk, cmd == CUSE_IOCTL_READ_DATA); } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_SELWAKEUP: - cuse_lock(); + cuse_server_lock(pcs); /* * We don't know which direction caused the event. * Wakeup both! */ cuse_server_wakeup_all_client_locked(pcs); - cuse_unlock(); + cuse_server_unlock(pcs); break; default: @@ -1319,31 +1331,31 @@ cuse_server_mmap_single(struct cdev *dev, vm_ooffset_t if (error != 0) return (error); - cuse_lock(); + cuse_server_lock(pcs); /* lookup memory structure */ TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENOMEM); } /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; if (page_nr >= mem->page_count) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENXIO); } /* verify mmap size */ if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } vm_object_reference(mem->object); *object = mem->object; - cuse_unlock(); + cuse_server_unlock(pcs); /* set new VM object offset to use */ *offset = page_nr * PAGE_SIZE; @@ -1363,10 +1375,12 @@ cuse_client_free(void *arg) struct cuse_server *pcs; int n; - cuse_lock(); + pcs = pcc->server; + + cuse_server_lock(pcs); cuse_client_is_closing(pcc); - TAILQ_REMOVE(&pcc->server->hcli, pcc, entry); - cuse_unlock(); + TAILQ_REMOVE(&pcs->hcli, pcc, entry); + cuse_server_unlock(pcs); for (n = 0; n != CUSE_CMD_MAX; n++) { @@ -1376,8 +1390,6 @@ cuse_client_free(void *arg) cv_destroy(&pccmd->cv); } - pcs = pcc->server; - free(pcc, M_CUSE); /* drop reference on server */ @@ -1395,11 +1407,12 @@ cuse_client_open(struct cdev *dev, int fflags, int dev int error; int n; - cuse_lock(); pcsd = dev->si_drv1; if (pcsd != NULL) { pcs = pcsd->server; pcd = pcsd->user_dev; + + cuse_server_lock(pcs); /* * Check that the refcount didn't wrap and that the * same process is not both client and server. This @@ -1410,17 +1423,14 @@ cuse_client_open(struct cdev *dev, int fflags, int dev if (pcs->refs < 0 || pcs->pid == curproc->p_pid) { /* overflow or wrong PID */ pcs->refs--; - pcsd = NULL; + cuse_server_unlock(pcs); + return (EINVAL); } + cuse_server_unlock(pcs); } else { - pcs = NULL; - pcd = NULL; + return (EINVAL); } - cuse_unlock(); - if (pcsd == NULL) - return (EINVAL); - pcc = malloc(sizeof(*pcc), M_CUSE, M_WAITOK | M_ZERO); if (pcc == NULL) { /* drop reference on server */ @@ -1450,7 +1460,7 @@ cuse_client_open(struct cdev *dev, int fflags, int dev cv_init(&pccmd->cv, "cuse-client-cv"); } - cuse_lock(); + cuse_server_lock(pcs); /* cuse_client_free() assumes that the client is listed somewhere! */ /* always enqueue */ @@ -1463,7 +1473,7 @@ cuse_client_open(struct cdev *dev, int fflags, int dev } else { error = 0; } - cuse_unlock(); + cuse_server_unlock(pcs); if (error) { devfs_clear_cdevpriv(); /* XXX bugfix */ @@ -1473,11 +1483,11 @@ cuse_client_open(struct cdev *dev, int fflags, int dev cuse_cmd_lock(pccmd); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, 0, pcc->fflags, 0); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1498,6 +1508,7 @@ cuse_client_close(struct cdev *dev, int fflag, int dev { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; error = cuse_client_get(&pcc); @@ -1505,20 +1516,18 @@ cuse_client_close(struct cdev *dev, int fflag, int dev return (0); pccmd = &pcc->cmds[CUSE_CMD_CLOSE]; + pcs = pcc->server; cuse_cmd_lock(pccmd); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, 0, pcc->fflags, 0); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); - cuse_cmd_unlock(pccmd); - cuse_lock(); cuse_client_is_closing(pcc); - cuse_unlock(); + cuse_server_unlock(pcs); return (0); } @@ -1526,21 +1535,22 @@ cuse_client_close(struct cdev *dev, int fflag, int dev static void cuse_client_kqfilter_poll(struct cdev *dev, struct cuse_client *pcc) { + struct cuse_server *pcs = pcc->server; int temp; - cuse_lock(); + cuse_server_lock(pcs); temp = (pcc->cflags & (CUSE_CLI_KNOTE_HAS_READ | CUSE_CLI_KNOTE_HAS_WRITE)); pcc->cflags &= ~(CUSE_CLI_KNOTE_NEED_READ | CUSE_CLI_KNOTE_NEED_WRITE); - cuse_unlock(); + cuse_server_unlock(pcs); if (temp != 0) { /* get the latest polling state from the server */ temp = cuse_client_poll(dev, POLLIN | POLLOUT, NULL); if (temp & (POLLIN | POLLOUT)) { - cuse_lock(); + cuse_server_lock(pcs); if (temp & POLLIN) pcc->cflags |= CUSE_CLI_KNOTE_NEED_READ; if (temp & POLLOUT) @@ -1548,7 +1558,7 @@ cuse_client_kqfilter_poll(struct cdev *dev, struct cus /* make sure the "knote" gets woken up */ cuse_server_wakeup_locked(pcc->server); - cuse_unlock(); + cuse_server_unlock(pcs); } } } @@ -1558,6 +1568,7 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1566,6 +1577,7 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in return (error); pccmd = &pcc->cmds[CUSE_CMD_READ]; + pcs = pcc->server; if (uio->uio_segflg != UIO_USERSPACE) { return (EINVAL); @@ -1582,13 +1594,13 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in } len = uio->uio_iov->iov_len; - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (uintptr_t)uio->uio_iov->iov_base, (unsigned long)(unsigned int)len, pcc->fflags, ioflag); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1617,6 +1629,7 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1625,6 +1638,7 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i return (error); pccmd = &pcc->cmds[CUSE_CMD_WRITE]; + pcs = pcc->server; if (uio->uio_segflg != UIO_USERSPACE) { return (EINVAL); @@ -1641,13 +1655,13 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i } len = uio->uio_iov->iov_len; - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (uintptr_t)uio->uio_iov->iov_base, (unsigned long)(unsigned int)len, pcc->fflags, ioflag); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1677,6 +1691,7 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1689,6 +1704,7 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, return (ENOMEM); pccmd = &pcc->cmds[CUSE_CMD_IOCTL]; + pcs = pcc->server; cuse_cmd_lock(pccmd); @@ -1701,14 +1717,14 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, * is forwarded to the driver. */ - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (len == 0) ? *(long *)data : CUSE_BUF_MIN_PTR, (unsigned long)cmd, pcc->fflags, (fflag & O_NONBLOCK) ? IO_NDELAY : 0); error = cuse_client_receive_command_locked(pccmd, data, len); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1732,6 +1748,7 @@ cuse_client_poll(struct cdev *dev, int events, struct { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; unsigned long temp; int error; int revents; @@ -1741,6 +1758,7 @@ cuse_client_poll(struct cdev *dev, int events, struct goto pollnval; temp = 0; + pcs = pcc->server; if (events & (POLLPRI | POLLIN | POLLRDNORM)) temp |= CUSE_POLL_READ; @@ -1757,14 +1775,14 @@ cuse_client_poll(struct cdev *dev, int events, struct /* Need to selrecord() first to not loose any events. */ if (temp != 0 && td != NULL) - selrecord(td, &pcc->server->selinfo); + selrecord(td, &pcs->selinfo); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, temp, pcc->fflags, IO_NDELAY); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_cmd_unlock(pccmd); @@ -1795,37 +1813,40 @@ cuse_client_mmap_single(struct cdev *dev, vm_ooffset_t uint32_t alloc_nr = page_nr / CUSE_ALLOC_PAGES_MAX; struct cuse_memory *mem; struct cuse_client *pcc; + struct cuse_server *pcs; int error; error = cuse_client_get(&pcc); if (error != 0) return (error); - cuse_lock(); + pcs = pcc->server; + + cuse_server_lock(pcs); /* lookup memory structure */ - TAILQ_FOREACH(mem, &pcc->server->hmem, entry) { + TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENOMEM); } /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; if (page_nr >= mem->page_count) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENXIO); } /* verify mmap size */ if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } vm_object_reference(mem->object); *object = mem->object; - cuse_unlock(); + cuse_server_unlock(pcs); /* set new VM object offset to use */ *offset = page_nr * PAGE_SIZE; @@ -1838,22 +1859,28 @@ static void cuse_client_kqfilter_read_detach(struct knote *kn) { struct cuse_client *pcc; + struct cuse_server *pcs; - cuse_lock(); pcc = kn->kn_hook; - knlist_remove(&pcc->server->selinfo.si_note, kn, 1); - cuse_unlock(); + pcs = pcc->server; + + cuse_server_lock(pcs); + knlist_remove(&pcs->selinfo.si_note, kn, 1); + cuse_server_unlock(pcs); } static void cuse_client_kqfilter_write_detach(struct knote *kn) { struct cuse_client *pcc; + struct cuse_server *pcs; - cuse_lock(); pcc = kn->kn_hook; - knlist_remove(&pcc->server->selinfo.si_note, kn, 1); - cuse_unlock(); + pcs = pcc->server; + + cuse_server_lock(pcs); + knlist_remove(&pcs->selinfo.si_note, kn, 1); + cuse_server_unlock(pcs); } static int @@ -1861,9 +1888,10 @@ cuse_client_kqfilter_read_event(struct knote *kn, long { struct cuse_client *pcc; - mtx_assert(&cuse_mtx, MA_OWNED); - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Apr 6 07:16:35 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3615D2A54F8; Mon, 6 Apr 2020 07:16:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48whfq0X6Zz4cJd; Mon, 6 Apr 2020 07:16:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08E1824265; Mon, 6 Apr 2020 07:16:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0367GYZU020202; Mon, 6 Apr 2020 07:16:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0367GVPK020189; Mon, 6 Apr 2020 07:16:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004060716.0367GVPK020189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Apr 2020 07:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359652 - in stable/11/sys: dev/acpica fs/cuse i386/bios kern net X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: dev/acpica fs/cuse i386/bios kern net X-SVN-Commit-Revision: 359652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 07:16:35 -0000 Author: hselasky Date: Mon Apr 6 07:16:31 2020 New Revision: 359652 URL: https://svnweb.freebsd.org/changeset/base/359652 Log: MFC r333806: Use NULL for SYSINIT's last arg, which is a pointer type Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/acpica/acpi.c stable/11/sys/fs/cuse/cuse.c stable/11/sys/i386/bios/apm.c stable/11/sys/kern/imgact_binmisc.c stable/11/sys/kern/kern_linker.c stable/11/sys/kern/kern_module.c stable/11/sys/kern/kern_synch.c stable/11/sys/kern/kern_sysctl.c stable/11/sys/kern/link_elf.c stable/11/sys/kern/link_elf_obj.c stable/11/sys/kern/posix4_mib.c stable/11/sys/kern/subr_pcpu.c stable/11/sys/net/route.c stable/11/sys/net/vnet.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpica/acpi.c ============================================================================== --- stable/11/sys/dev/acpica/acpi.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/dev/acpica/acpi.c Mon Apr 6 07:16:31 2020 (r359652) @@ -4158,4 +4158,4 @@ acpi_pm_register(void *arg) power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, NULL); } -SYSINIT(power, SI_SUB_KLD, SI_ORDER_ANY, acpi_pm_register, 0); +SYSINIT(power, SI_SUB_KLD, SI_ORDER_ANY, acpi_pm_register, NULL); Modified: stable/11/sys/fs/cuse/cuse.c ============================================================================== --- stable/11/sys/fs/cuse/cuse.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/fs/cuse/cuse.c Mon Apr 6 07:16:31 2020 (r359652) @@ -268,7 +268,7 @@ cuse_kern_init(void *arg) (CUSE_VERSION >> 16) & 0xFF, (CUSE_VERSION >> 8) & 0xFF, (CUSE_VERSION >> 0) & 0xFF); } -SYSINIT(cuse_kern_init, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_init, 0); +SYSINIT(cuse_kern_init, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_init, NULL); static void cuse_kern_uninit(void *arg) Modified: stable/11/sys/i386/bios/apm.c ============================================================================== --- stable/11/sys/i386/bios/apm.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/i386/bios/apm.c Mon Apr 6 07:16:31 2020 (r359652) @@ -1589,4 +1589,4 @@ apm_pm_register(void *arg) power_pm_register(POWER_PM_TYPE_APM, apm_pm_func, NULL); } -SYSINIT(power, SI_SUB_KLD, SI_ORDER_ANY, apm_pm_register, 0); +SYSINIT(power, SI_SUB_KLD, SI_ORDER_ANY, apm_pm_register, NULL); Modified: stable/11/sys/kern/imgact_binmisc.c ============================================================================== --- stable/11/sys/kern/imgact_binmisc.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/imgact_binmisc.c Mon Apr 6 07:16:31 2020 (r359652) @@ -747,8 +747,10 @@ imgact_binmisc_fini(void *arg) sx_destroy(&interp_list_sx); } -SYSINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_init, 0); -SYSUNINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_fini, 0); +SYSINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_init, + NULL); +SYSUNINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_fini, + NULL); /* * Tell kern_execve.c about it, with a little help from the linker. Modified: stable/11/sys/kern/kern_linker.c ============================================================================== --- stable/11/sys/kern/kern_linker.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/kern_linker.c Mon Apr 6 07:16:31 2020 (r359652) @@ -161,7 +161,7 @@ linker_init(void *arg) TAILQ_INIT(&linker_files); } -SYSINIT(linker, SI_SUB_KLD, SI_ORDER_FIRST, linker_init, 0); +SYSINIT(linker, SI_SUB_KLD, SI_ORDER_FIRST, linker_init, NULL); static void linker_stop_class_add(void *arg) @@ -409,7 +409,7 @@ linker_init_kernel_modules(void) } SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules, - 0); + NULL); static int linker_load_file(const char *filename, linker_file_t *result) @@ -1680,7 +1680,7 @@ fail: /* woohoo! we made it! */ } -SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0); +SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, NULL); /* * Search for a not-loaded module by name. Modified: stable/11/sys/kern/kern_module.c ============================================================================== --- stable/11/sys/kern/kern_module.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/kern_module.c Mon Apr 6 07:16:31 2020 (r359652) @@ -89,7 +89,7 @@ module_init(void *arg) SHUTDOWN_PRI_DEFAULT); } -SYSINIT(module, SI_SUB_KLD, SI_ORDER_FIRST, module_init, 0); +SYSINIT(module, SI_SUB_KLD, SI_ORDER_FIRST, module_init, NULL); static void module_shutdown(void *arg1, int arg2) Modified: stable/11/sys/kern/kern_synch.c ============================================================================== --- stable/11/sys/kern/kern_synch.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/kern_synch.c Mon Apr 6 07:16:31 2020 (r359652) @@ -107,7 +107,7 @@ sleepinit(void *unused) * vmem tries to lock the sleepq mutexes when free'ing kva, so make sure * it is available. */ -SYSINIT(sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepinit, 0); +SYSINIT(sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepinit, NULL); /* * General sleep call. Suspends the current thread until a wakeup is Modified: stable/11/sys/kern/kern_sysctl.c ============================================================================== --- stable/11/sys/kern/kern_sysctl.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/kern_sysctl.c Mon Apr 6 07:16:31 2020 (r359652) @@ -829,7 +829,7 @@ sysctl_register_all(void *arg) sysctl_register_oid(*oidp); SYSCTL_WUNLOCK(); } -SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_register_all, 0); +SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_register_all, NULL); /* * "Staff-functions" Modified: stable/11/sys/kern/link_elf.c ============================================================================== --- stable/11/sys/kern/link_elf.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/link_elf.c Mon Apr 6 07:16:31 2020 (r359652) @@ -464,7 +464,7 @@ link_elf_init(void* arg) #endif } -SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, 0); +SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, NULL); static int link_elf_preload_parse_symbols(elf_file_t ef) Modified: stable/11/sys/kern/link_elf_obj.c ============================================================================== --- stable/11/sys/kern/link_elf_obj.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/link_elf_obj.c Mon Apr 6 07:16:31 2020 (r359652) @@ -192,7 +192,7 @@ link_elf_init(void *arg) linker_add_class(&link_elf_class); } -SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, 0); +SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL); static int link_elf_link_preload(linker_class_t cls, const char *filename, Modified: stable/11/sys/kern/posix4_mib.c ============================================================================== --- stable/11/sys/kern/posix4_mib.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/posix4_mib.c Mon Apr 6 07:16:31 2020 (r359652) @@ -171,5 +171,5 @@ p31b_set_standard(void *dummy) } SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard, - 0); + NULL); Modified: stable/11/sys/kern/subr_pcpu.c ============================================================================== --- stable/11/sys/kern/subr_pcpu.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/kern/subr_pcpu.c Mon Apr 6 07:16:31 2020 (r359652) @@ -125,7 +125,7 @@ dpcpu_startup(void *dummy __unused) TAILQ_INSERT_HEAD(&dpcpu_head, df, df_link); sx_init(&dpcpu_lock, "dpcpu alloc lock"); } -SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, 0); +SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, NULL); /* * UMA_PCPU_ZONE zones, that are available for all kernel Modified: stable/11/sys/net/route.c ============================================================================== --- stable/11/sys/net/route.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/net/route.c Mon Apr 6 07:16:31 2020 (r359652) @@ -227,7 +227,7 @@ route_init(void) if (rt_numfibs == 0) rt_numfibs = 1; } -SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, 0); +SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, NULL); static int rtentry_zinit(void *mem, int size, int how) Modified: stable/11/sys/net/vnet.c ============================================================================== --- stable/11/sys/net/vnet.c Mon Apr 6 07:09:04 2020 (r359651) +++ stable/11/sys/net/vnet.c Mon Apr 6 07:16:31 2020 (r359652) @@ -348,7 +348,7 @@ vnet_data_startup(void *dummy __unused) TAILQ_INSERT_HEAD(&vnet_data_free_head, df, vnd_link); sx_init(&vnet_data_free_lock, "vnet_data alloc lock"); } -SYSINIT(vnet_data, SI_SUB_KLD, SI_ORDER_FIRST, vnet_data_startup, 0); +SYSINIT(vnet_data, SI_SUB_KLD, SI_ORDER_FIRST, vnet_data_startup, NULL); /* Dummy VNET_SYSINIT to make sure we always reach the final end state. */ static void From owner-svn-src-stable-11@freebsd.org Mon Apr 6 22:14:50 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EEFB27DB90; Mon, 6 Apr 2020 22:14:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48x4bG3FBTz4gDW; Mon, 6 Apr 2020 22:14:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A8E52F1C9; Mon, 6 Apr 2020 22:14:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036MEoC9072294; Mon, 6 Apr 2020 22:14:50 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036MEoKC072293; Mon, 6 Apr 2020 22:14:50 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <202004062214.036MEoKC072293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 6 Apr 2020 22:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359670 - stable/11/sys/ufs/ufs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/ufs/ufs X-SVN-Commit-Revision: 359670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 22:14:50 -0000 Author: mckusick Date: Mon Apr 6 22:14:50 2020 New Revision: 359670 URL: https://svnweb.freebsd.org/changeset/base/359670 Log: MFC of 359612 Use proper boolean expressions for soft update macros. Sponsored by: Netflix Modified: stable/11/sys/ufs/ufs/inode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ufs/inode.h ============================================================================== --- stable/11/sys/ufs/ufs/inode.h Mon Apr 6 22:12:42 2020 (r359669) +++ stable/11/sys/ufs/ufs/inode.h Mon Apr 6 22:14:50 2020 (r359670) @@ -190,10 +190,11 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) -#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) -#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) -#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) +#define DOINGSOFTDEP(vp) \ + (((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) +#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) +#define DOINGSUJ(vp) (((vp)->v_mount->mnt_flag & MNT_SUJ) != 0) +#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & MNT_SUJ) != 0) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-stable-11@freebsd.org Tue Apr 7 16:29:13 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A9202745C3; Tue, 7 Apr 2020 16:29:13 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xXt10NJ6z3PNl; Tue, 7 Apr 2020 16:29:13 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08475C9E8; Tue, 7 Apr 2020 16:29:13 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GTC2E042134; Tue, 7 Apr 2020 16:29:12 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GTBns042126; Tue, 7 Apr 2020 16:29:11 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071629.037GTBns042126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359695 - in stable/11: sbin/ipfw sys/netinet/libalias X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/11: sbin/ipfw sys/netinet/libalias X-SVN-Commit-Revision: 359695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:29:13 -0000 Author: eugen Date: Tue Apr 7 16:29:11 2020 New Revision: 359695 URL: https://svnweb.freebsd.org/changeset/base/359695 Log: MFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets to libalias and ipfw. In libalias, a new flag PKT_ALIAS_UNREGISTERED_RFC6598 is added. This is like PKT_ALIAS_UNREGISTERED_ONLY, but also is RFC 6598 aware. Also, we add a new NAT option to ipfw called unreg_cgn, which is like unreg_only, but also is RFC 6598-aware. The reason for the new flags/options is to avoid breaking existing networks, especially those which rely on RFC 6598 as an external address. Submitted by: Neel Chauhan Reviewed by: melifaro, rgrimes, Lutz Donnerhacke Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22877 Differential Revision: https://reviews.freebsd.org/D23448 Modified: stable/11/sbin/ipfw/ipfw.8 stable/11/sbin/ipfw/ipfw2.h stable/11/sbin/ipfw/main.c stable/11/sbin/ipfw/nat.c stable/11/sys/netinet/libalias/alias.c stable/11/sys/netinet/libalias/alias.h stable/11/sys/netinet/libalias/libalias.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sbin/ipfw/ipfw.8 Tue Apr 7 16:29:11 2020 (r359695) @@ -3228,8 +3228,11 @@ Deny any incoming connection from outside world. Try to leave the alias port numbers unchanged from the actual local port numbers. .It Cm unreg_only -Traffic on the local network not originating from an +Traffic on the local network not originating from a RFC 1918 unregistered address spaces will be ignored. +.It Cm unreg_cgn +Like unreg_only, but includes the RFC 6598 (Carrier Grade NAT) +address range. .It Cm reset Reset table of the packet aliasing engine on address change. .It Cm reverse Modified: stable/11/sbin/ipfw/ipfw2.h ============================================================================== --- stable/11/sbin/ipfw/ipfw2.h Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sbin/ipfw/ipfw2.h Tue Apr 7 16:29:11 2020 (r359695) @@ -220,6 +220,7 @@ enum tokens { TOK_DENY_INC, TOK_SAME_PORTS, TOK_UNREG_ONLY, + TOK_UNREG_CGN, TOK_SKIP_GLOBAL, TOK_RESET_ADDR, TOK_ALIAS_REV, Modified: stable/11/sbin/ipfw/main.c ============================================================================== --- stable/11/sbin/ipfw/main.c Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sbin/ipfw/main.c Tue Apr 7 16:29:11 2020 (r359695) @@ -43,8 +43,8 @@ help(void) "add [num] [set N] [prob x] RULE-BODY\n" "{pipe|queue} N config PIPE-BODY\n" "[pipe|queue] {zero|delete|show} [N{,N}]\n" -"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n" -" reverse|proxy_only|redirect_addr linkspec|\n" +"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n" +" reset|reverse|proxy_only|redirect_addr linkspec|\n" " redirect_port linkspec|redirect_proto linkspec}\n" "set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n" "set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n" Modified: stable/11/sbin/ipfw/nat.c ============================================================================== --- stable/11/sbin/ipfw/nat.c Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sbin/ipfw/nat.c Tue Apr 7 16:29:11 2020 (r359695) @@ -60,6 +60,7 @@ static struct _s_x nat_params[] = { { "deny_in", TOK_DENY_INC }, { "same_ports", TOK_SAME_PORTS }, { "unreg_only", TOK_UNREG_ONLY }, + { "unreg_cgn", TOK_UNREG_CGN }, { "skip_global", TOK_SKIP_GLOBAL }, { "reset", TOK_RESET_ADDR }, { "reverse", TOK_ALIAS_REV }, @@ -663,6 +664,9 @@ nat_show_cfg(struct nat44_cfg_nat *n, void *arg) } else if (n->mode & PKT_ALIAS_UNREGISTERED_ONLY) { printf(" unreg_only"); n->mode &= ~PKT_ALIAS_UNREGISTERED_ONLY; + } else if (n->mode & PKT_ALIAS_UNREGISTERED_CGN) { + printf(" unreg_cgn"); + n->mode &= ~PKT_ALIAS_UNREGISTERED_CGN; } else if (n->mode & PKT_ALIAS_RESET_ON_ADDR_CHANGE) { printf(" reset"); n->mode &= ~PKT_ALIAS_RESET_ON_ADDR_CHANGE; @@ -789,6 +793,7 @@ ipfw_config_nat(int ac, char **av) case TOK_SAME_PORTS: case TOK_SKIP_GLOBAL: case TOK_UNREG_ONLY: + case TOK_UNREG_CGN: case TOK_RESET_ADDR: case TOK_ALIAS_REV: case TOK_PROXY_ONLY: @@ -882,6 +887,9 @@ ipfw_config_nat(int ac, char **av) break; case TOK_UNREG_ONLY: n->mode |= PKT_ALIAS_UNREGISTERED_ONLY; + break; + case TOK_UNREG_CGN: + n->mode |= PKT_ALIAS_UNREGISTERED_CGN; break; case TOK_SKIP_GLOBAL: n->mode |= PKT_ALIAS_SKIP_GLOBAL; Modified: stable/11/sys/netinet/libalias/alias.c ============================================================================== --- stable/11/sys/netinet/libalias/alias.c Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sys/netinet/libalias/alias.c Tue Apr 7 16:29:11 2020 (r359695) @@ -1411,6 +1411,10 @@ getout: #define UNREG_ADDR_C_LOWER 0xc0a80000 #define UNREG_ADDR_C_UPPER 0xc0a8ffff +/* 100.64.0.0 -> 100.127.255.255 (RFC 6598 - Carrier Grade NAT) */ +#define UNREG_ADDR_CGN_LOWER 0x64400000 +#define UNREG_ADDR_CGN_UPPER 0x647fffff + int LibAliasOut(struct libalias *la, char *ptr, int maxpacketsize) { @@ -1462,7 +1466,8 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* v } addr_save = GetDefaultAliasAddress(la); - if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY) { + if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY || + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) { u_long addr; int iclass; @@ -1474,6 +1479,9 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* v iclass = 2; else if (addr >= UNREG_ADDR_A_LOWER && addr <= UNREG_ADDR_A_UPPER) iclass = 1; + else if (addr >= UNREG_ADDR_CGN_LOWER && addr <= UNREG_ADDR_CGN_UPPER && + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) + iclass = 4; if (iclass == 0) { SetDefaultAliasAddress(la, pip->ip_src); Modified: stable/11/sys/netinet/libalias/alias.h ============================================================================== --- stable/11/sys/netinet/libalias/alias.h Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sys/netinet/libalias/alias.h Tue Apr 7 16:29:11 2020 (r359695) @@ -226,6 +226,14 @@ struct mbuf *m_megapullup(struct mbuf *, int); */ #define PKT_ALIAS_SKIP_GLOBAL 0x200 +/* + * Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 + * (Carrier Grade NAT) address range as follows: + * + * 100.64.0.0 -> 100.127.255.255 + */ +#define PKT_ALIAS_UNREGISTERED_CGN 0x400 + /* Function return codes. */ #define PKT_ALIAS_ERROR -1 #define PKT_ALIAS_OK 1 Modified: stable/11/sys/netinet/libalias/libalias.3 ============================================================================== --- stable/11/sys/netinet/libalias/libalias.3 Tue Apr 7 16:27:58 2020 (r359694) +++ stable/11/sys/netinet/libalias/libalias.3 Tue Apr 7 16:29:11 2020 (r359695) @@ -212,6 +212,11 @@ This option is useful in the case that the packet alia registered and unregistered subnets on different interfaces. The registered subnet is fully accessible to the outside world, so traffic from it does not need to be passed through the packet aliasing engine. +.It Dv PKT_ALIAS_UNREGISTERED_CGN +Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 (Carrier Grade +NAT) subnet as follows: +.Pp +100.64.0.0 -> 100.127.255.255 (RFC 6598 subnet) .It Dv PKT_ALIAS_RESET_ON_ADDR_CHANGE When this mode bit is set and .Fn LibAliasSetAddress From owner-svn-src-stable-11@freebsd.org Tue Apr 7 16:47:36 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B98274F2E; Tue, 7 Apr 2020 16:47:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYHD0GtPz3QfS; Tue, 7 Apr 2020 16:47:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04909CDE2; Tue, 7 Apr 2020 16:47:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GlZAH054070; Tue, 7 Apr 2020 16:47:35 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GlZjb054068; Tue, 7 Apr 2020 16:47:35 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071647.037GlZjb054068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359698 - in stable/11: share/man/man4 sys/netgraph X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 359698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:47:36 -0000 Author: eugen Date: Tue Apr 7 16:47:35 2020 New Revision: 359698 URL: https://svnweb.freebsd.org/changeset/base/359698 Log: MFC r342168,357786: Allow ng_nat to be attached to a ethernet interface Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4) or the likes. Add new control message types: setdlt and getdlt to switch from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet). Submitted by: sobomax Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D18535 Relnotes: yes Modified: stable/11/share/man/man4/ng_nat.4 stable/11/sys/netgraph/ng_nat.c stable/11/sys/netgraph/ng_nat.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ng_nat.4 ============================================================================== --- stable/11/share/man/man4/ng_nat.4 Tue Apr 7 16:44:14 2020 (r359697) +++ stable/11/share/man/man4/ng_nat.4 Tue Apr 7 16:47:35 2020 (r359698) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2013 +.Dd December 12, 2018 .Dt NG_NAT 4 .Os .Sh NAME @@ -264,6 +264,38 @@ from its .Xr libalias instance, the corresponding field is returned as .Va UINT32_MAX . +.It Dv NGM_NAT_SET_DLT Pq Ic setdlt +Sets the data link type on the +.Va in +and +.Va out +hooks. +Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams , no offset applied, the default) and +.Cm DLT_EN10MB +(Ethernet). DLT_ definitions can be found in +.In net/bpf.h . +If you want to work on the +.Xr ipfw 8 +level you must use no additional offset by specifying +.Cm DLT_RAW . +If, however, you attach +.Nm +to a network interface directly and +.Cm EN10MB +is specified, then the extra offset will be applied to take into account +link-level header. +In this mode the +.Nm +would also inspect appropriate type field in the Ethernet header and +pass-through any datagrams that are not IP packets. +.It Dv NGM_NAT_GET_DLT Pq Ic getdlt +This control message returns the current data link type of the +.Va in +and +.Va out +hooks. .El .Pp In all redirection messages @@ -336,11 +368,31 @@ serial line with HDLC encapsulation. SEQ ifconfig ng0 x.y.8.35 x.y.8.1 .Ed +.Pp +The +.Nm +node can also be attached directly to the physical interface +via +.Xr ng_ether 4 +node in the graph. +In the following example, we perform masquerading on a +Ethernet interface connected to a public network. +.Bd -literal -offset indent +ifconfig igb0 inet x.y.8.35 netmask 0xfffff000 +route add default x.y.0.1 +/usr/sbin/ngctl -f- <<-SEQ + mkpeer igb0: nat lower in + name igb0:lower igb0_NAT + connect igb0: igb0_NAT: upper out + msg igb0_NAT: setdlt 1 + msg igb0_NAT: setaliasaddr x.y.8.35 +SEQ .Sh SEE ALSO .Xr libalias 3 , .Xr ng_ipfw 4 , .Xr natd 8 , -.Xr ngctl 8 +.Xr ngctl 8 , +.Xr ng_ether 8 .Sh HISTORY The .Nm Modified: stable/11/sys/netgraph/ng_nat.c ============================================================================== --- stable/11/sys/netgraph/ng_nat.c Tue Apr 7 16:44:14 2020 (r359697) +++ stable/11/sys/netgraph/ng_nat.c Tue Apr 7 16:47:35 2020 (r359698) @@ -42,6 +42,9 @@ #include #include +#include +#include + #include #include @@ -239,6 +242,20 @@ static const struct ng_cmdlist ng_nat_cmdlist[] = { NULL, &ng_nat_libalias_info_type }, + { + NGM_NAT_COOKIE, + NGM_NAT_SET_DLT, + "setdlt", + &ng_parse_uint8_type, + NULL + }, + { + NGM_NAT_COOKIE, + NGM_NAT_GET_DLT, + "getdlt", + NULL, + &ng_parse_uint8_type + }, { 0 } }; @@ -275,6 +292,7 @@ struct ng_nat_priv { uint32_t rdrcount; /* number or redirects in list */ uint32_t nextid; /* for next in turn in list */ struct rdrhead redirhead; /* redirect list header */ + uint8_t dlt; /* DLT_XXX from bpf.h */ }; typedef struct ng_nat_priv *priv_p; @@ -300,6 +318,7 @@ ng_nat_constructor(node_p node) /* Init redirects housekeeping. */ priv->rdrcount = 0; priv->nextid = 1; + priv->dlt = DLT_RAW; STAILQ_INIT(&priv->redirhead); /* Link structs together. */ @@ -692,11 +711,34 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthoo #undef COPY } break; + case NGM_NAT_SET_DLT: + if (msg->header.arglen != sizeof(uint8_t)) { + error = EINVAL; + break; + } + switch (*(uint8_t *) msg->data) { + case DLT_EN10MB: + case DLT_RAW: + priv->dlt = *(uint8_t *) msg->data; + break; + default: + error = EINVAL; + break; + } + break; default: error = EINVAL; /* unknown command */ break; } break; + case NGM_NAT_GET_DLT: + NG_MKRESPONSE(resp, msg, sizeof(uint8_t), M_WAITOK); + if (resp == NULL) { + error = ENOMEM; + break; + } + *((uint8_t *) resp->data) = priv->dlt; + break; default: error = EINVAL; /* unknown cookie type */ break; @@ -713,7 +755,7 @@ ng_nat_rcvdata(hook_p hook, item_p item ) const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); struct mbuf *m; struct ip *ip; - int rval, error = 0; + int rval, ipofs, error = 0; char *c; /* We have no required hooks. */ @@ -736,12 +778,44 @@ ng_nat_rcvdata(hook_p hook, item_p item ) NGI_M(item) = m; - c = mtod(m, char *); - ip = mtod(m, struct ip *); + switch (priv->dlt) { + case DLT_RAW: + ipofs = 0; + break; + case DLT_EN10MB: + { + struct ether_header *eh; - KASSERT(m->m_pkthdr.len == ntohs(ip->ip_len), - ("ng_nat: ip_len != m_pkthdr.len")); + if (m->m_pkthdr.len < sizeof(struct ether_header)) { + NG_FREE_ITEM(item); + return (ENXIO); + } + eh = mtod(m, struct ether_header *); + switch (ntohs(eh->ether_type)) { + case ETHERTYPE_IP: + case ETHERTYPE_IPV6: + ipofs = sizeof(struct ether_header); + break; + default: + goto send; + } + break; + } + default: + panic("Corrupted priv->dlt: %u", priv->dlt); + } + if (m->m_pkthdr.len < ipofs + sizeof(struct ip)) + goto send; /* packet too short to hold IP */ + + c = (char *)mtodo(m, ipofs); + ip = (struct ip *)mtodo(m, ipofs); + + if (ip->ip_v != IPVERSION) + goto send; /* other IP version, let it pass */ + if (m->m_pkthdr.len < ipofs + ntohs(ip->ip_len)) + goto send; /* packet too short (i.e. fragmented or broken) */ + /* * We drop packet when: * 1. libalias returns PKT_ALIAS_ERROR; @@ -751,7 +825,8 @@ ng_nat_rcvdata(hook_p hook, item_p item ) * PKT_ALIAS_DENY_INCOMING flag is set. */ if (hook == priv->in) { - rval = LibAliasIn(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); + rval = LibAliasIn(priv->lib, c, m->m_len - ipofs + + M_TRAILINGSPACE(m)); if (rval == PKT_ALIAS_ERROR || rval == PKT_ALIAS_UNRESOLVED_FRAGMENT || (rval == PKT_ALIAS_IGNORED && @@ -761,7 +836,8 @@ ng_nat_rcvdata(hook_p hook, item_p item ) return (EINVAL); } } else if (hook == priv->out) { - rval = LibAliasOut(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); + rval = LibAliasOut(priv->lib, c, m->m_len - ipofs + + M_TRAILINGSPACE(m)); if (rval == PKT_ALIAS_ERROR) { NG_FREE_ITEM(item); return (EINVAL); @@ -771,7 +847,7 @@ ng_nat_rcvdata(hook_p hook, item_p item ) if (rval == PKT_ALIAS_RESPOND) m->m_flags |= M_SKIP_FIREWALL; - m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len); + m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len) + ipofs; if ((ip->ip_off & htons(IP_OFFMASK)) == 0 && ip->ip_p == IPPROTO_TCP) { Modified: stable/11/sys/netgraph/ng_nat.h ============================================================================== --- stable/11/sys/netgraph/ng_nat.h Tue Apr 7 16:44:14 2020 (r359697) +++ stable/11/sys/netgraph/ng_nat.h Tue Apr 7 16:47:35 2020 (r359698) @@ -203,6 +203,8 @@ enum { NGM_NAT_SET_IPADDR = 1, NGM_NAT_SET_MODE, NGM_NAT_SET_TARGET, + NGM_NAT_SET_DLT, + NGM_NAT_GET_DLT, NGM_NAT_REDIRECT_PORT, NGM_NAT_REDIRECT_ADDR, NGM_NAT_REDIRECT_PROTO, From owner-svn-src-stable-11@freebsd.org Tue Apr 7 16:57:24 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BD792753FE; Tue, 7 Apr 2020 16:57:24 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYVX0G0Yz3wZf; Tue, 7 Apr 2020 16:57:24 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0411BCFE5; Tue, 7 Apr 2020 16:57:24 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GvNRR060146; Tue, 7 Apr 2020 16:57:23 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GvNSr060145; Tue, 7 Apr 2020 16:57:23 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071657.037GvNSr060145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359701 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 359701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:57:24 -0000 Author: eugen Date: Tue Apr 7 16:57:23 2020 New Revision: 359701 URL: https://svnweb.freebsd.org/changeset/base/359701 Log: MFC r356943,356944: Correct "service ipfw status" for INET6-only systems. Modified: stable/11/etc/rc.d/ipfw Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/ipfw ============================================================================== --- stable/11/etc/rc.d/ipfw Tue Apr 7 16:56:34 2020 (r359700) +++ stable/11/etc/rc.d/ipfw Tue Apr 7 16:57:23 2020 (r359701) @@ -127,7 +127,11 @@ ipfw_stop() ipfw_status() { status=$(sysctl -n net.inet.ip.fw.enable) - if [ ${status} -eq 0 ]; then + : ${status:=0} + if afexists inet6; then + status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable))) + fi + if [ ${status} -eq 0 ]; then echo "ipfw is not enabled" exit 1 else From owner-svn-src-stable-11@freebsd.org Tue Apr 7 17:05:06 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 859CE275D7B; Tue, 7 Apr 2020 17:05:06 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYgQ2zyBz3xQs; Tue, 7 Apr 2020 17:05:06 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61D50D1CC; Tue, 7 Apr 2020 17:05:06 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037H56mW066264; Tue, 7 Apr 2020 17:05:06 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037H56qh066263; Tue, 7 Apr 2020 17:05:06 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071705.037H56qh066263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 17:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359703 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 359703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:05:06 -0000 Author: eugen Date: Tue Apr 7 17:05:05 2020 New Revision: 359703 URL: https://svnweb.freebsd.org/changeset/base/359703 Log: Style fix for /etc/rc.d/ipfw: correct bad identation after r359701. Modified: stable/11/etc/rc.d/ipfw Modified: stable/11/etc/rc.d/ipfw ============================================================================== --- stable/11/etc/rc.d/ipfw Tue Apr 7 17:04:24 2020 (r359702) +++ stable/11/etc/rc.d/ipfw Tue Apr 7 17:05:05 2020 (r359703) @@ -126,18 +126,18 @@ ipfw_stop() ipfw_status() { - status=$(sysctl -n net.inet.ip.fw.enable) + status=$(sysctl -n net.inet.ip.fw.enable) : ${status:=0} if afexists inet6; then status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable))) fi if [ ${status} -eq 0 ]; then - echo "ipfw is not enabled" - exit 1 - else - echo "ipfw is enabled" - exit 0 - fi + echo "ipfw is not enabled" + exit 1 + else + echo "ipfw is enabled" + exit 0 + fi } load_rc_config $name From owner-svn-src-stable-11@freebsd.org Tue Apr 7 17:50:18 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D13D7277ACC; Tue, 7 Apr 2020 17:50:18 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZgZ5FDvz41xl; Tue, 7 Apr 2020 17:50:18 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF356D9D2; Tue, 7 Apr 2020 17:50:18 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037HoIpl090662; Tue, 7 Apr 2020 17:50:18 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037HoIAx090660; Tue, 7 Apr 2020 17:50:18 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071750.037HoIAx090660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 17:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359708 - in stable/11: share/man/man4 sys/netgraph X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 359708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:50:18 -0000 Author: eugen Date: Tue Apr 7 17:50:18 2020 New Revision: 359708 URL: https://svnweb.freebsd.org/changeset/base/359708 Log: MFC r357053 by markj: ng_nat: Pass IPv6 packets through. ng_nat implements NAT for IPv4 traffic only. When connected to an ng_ether node it erroneously handled IPv6 packets as well. This change is not sufficient: ng_nat does not do any validation of IP packets in this mode, even though they have not yet passed through ip_input(). PR: 243096 Reported by: Robert James Hernandez Reviewed by: julian Differential Revision: https://reviews.freebsd.org/D23080 Modified: stable/11/share/man/man4/ng_nat.4 stable/11/sys/netgraph/ng_nat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ng_nat.4 ============================================================================== --- stable/11/share/man/man4/ng_nat.4 Tue Apr 7 17:49:36 2020 (r359707) +++ stable/11/share/man/man4/ng_nat.4 Tue Apr 7 17:50:18 2020 (r359708) @@ -35,7 +35,7 @@ .Sh DESCRIPTION An .Nm -node performs network address translation (NAT) of packets +node performs network address translation (NAT) of IPv4 packets passing through it. A .Nm nat Modified: stable/11/sys/netgraph/ng_nat.c ============================================================================== --- stable/11/sys/netgraph/ng_nat.c Tue Apr 7 17:49:36 2020 (r359707) +++ stable/11/sys/netgraph/ng_nat.c Tue Apr 7 17:50:18 2020 (r359708) @@ -793,7 +793,6 @@ ng_nat_rcvdata(hook_p hook, item_p item ) eh = mtod(m, struct ether_header *); switch (ntohs(eh->ether_type)) { case ETHERTYPE_IP: - case ETHERTYPE_IPV6: ipofs = sizeof(struct ether_header); break; default: From owner-svn-src-stable-11@freebsd.org Tue Apr 7 19:39:41 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B94F827B37D; Tue, 7 Apr 2020 19:39:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xd5n4WDbz47qQ; Tue, 7 Apr 2020 19:39:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96099EF27; Tue, 7 Apr 2020 19:39:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037Jdf6d056712; Tue, 7 Apr 2020 19:39:41 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037JdfVg056711; Tue, 7 Apr 2020 19:39:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071939.037JdfVg056711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359711 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 359711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:39:41 -0000 Author: bdrewery Date: Tue Apr 7 19:39:41 2020 New Revision: 359711 URL: https://svnweb.freebsd.org/changeset/base/359711 Log: MFC r357353: make all is needed to generate .depend.* Modified: stable/11/sys/conf/kern.post.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/kern.post.mk ============================================================================== --- stable/11/sys/conf/kern.post.mk Tue Apr 7 19:39:08 2020 (r359710) +++ stable/11/sys/conf/kern.post.mk Tue Apr 7 19:39:41 2020 (r359711) @@ -313,7 +313,7 @@ kernel-cleandepend: .PHONY kernel-tags: @ls .depend.* > /dev/null 2>&1 || \ - { echo "you must make depend first"; exit 1; } + { echo "you must make all first"; exit 1; } sh $S/conf/systags.sh kernel-install: .PHONY From owner-svn-src-stable-11@freebsd.org Tue Apr 7 19:40:17 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22CA427B442; Tue, 7 Apr 2020 19:40:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xd6R4X0Gz47yl; Tue, 7 Apr 2020 19:40:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CC0AEF2C; Tue, 7 Apr 2020 19:40:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037JeEap056871; Tue, 7 Apr 2020 19:40:14 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037JeE9L056870; Tue, 7 Apr 2020 19:40:14 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071940.037JeE9L056870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359713 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 359713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:40:18 -0000 Author: bdrewery Date: Tue Apr 7 19:40:14 2020 New Revision: 359713 URL: https://svnweb.freebsd.org/changeset/base/359713 Log: MFC r353771: Fix spelling of DPSRCS. Modified: stable/11/share/mk/bsd.dep.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.dep.mk ============================================================================== --- stable/11/share/mk/bsd.dep.mk Tue Apr 7 19:40:11 2020 (r359712) +++ stable/11/share/mk/bsd.dep.mk Tue Apr 7 19:40:14 2020 (r359713) @@ -177,7 +177,7 @@ DEPEND_MP?= -MP # avoid collisions. DEPEND_FILTER= C,/,_,g DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} -DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} +DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} ${DPSRCS:M*.cc} .if !empty(DEPENDSRCS) DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,} .endif From owner-svn-src-stable-11@freebsd.org Tue Apr 7 19:44:40 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB9FC27B8C8; Tue, 7 Apr 2020 19:44:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xdCX5Sy0z48X0; Tue, 7 Apr 2020 19:44:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EB4F11A; Tue, 7 Apr 2020 19:44:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037JieqR062689; Tue, 7 Apr 2020 19:44:40 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037JieAf062688; Tue, 7 Apr 2020 19:44:40 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071944.037JieAf062688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359715 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 359715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:44:40 -0000 Author: bdrewery Date: Tue Apr 7 19:44:40 2020 New Revision: 359715 URL: https://svnweb.freebsd.org/changeset/base/359715 Log: MFC r349729: Consider *clean targets as non-build targets as well. Modified: stable/11/share/mk/bsd.init.mk stable/11/share/mk/bsd.sys.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.init.mk ============================================================================== --- stable/11/share/mk/bsd.init.mk Tue Apr 7 19:44:37 2020 (r359714) +++ stable/11/share/mk/bsd.init.mk Tue Apr 7 19:44:40 2020 (r359715) @@ -46,11 +46,12 @@ $xGRP= ${_gid} # things like 'make all install' or 'make foo install'. # - non-build targets are called .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \ - ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) + ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) && !make(*clean) _SKIP_BUILD= not building at level 0 .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ ${.TARGETS:M*install*} == ${.TARGETS} || \ ${.TARGETS:Mclean*} == ${.TARGETS} || \ + ${.TARGETS:M*clean} == ${.TARGETS} || \ ${.TARGETS:Mdestroy*} == ${.TARGETS} || \ make(obj) || make(analyze) || make(print-dir) # Skip building, but don't show a warning. Modified: stable/11/share/mk/bsd.sys.mk ============================================================================== --- stable/11/share/mk/bsd.sys.mk Tue Apr 7 19:44:37 2020 (r359714) +++ stable/11/share/mk/bsd.sys.mk Tue Apr 7 19:44:40 2020 (r359715) @@ -244,7 +244,7 @@ PHONY_NOTMAIN = analyze afterdepend afterinstall all b .NOTMAIN: ${PHONY_NOTMAIN:Nall} .if ${MK_STAGING} != "no" -.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*)) +.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*) && !make(*clean)) _SKIP_STAGING?= yes .endif .if ${_SKIP_STAGING:Uno} == "yes" From owner-svn-src-stable-11@freebsd.org Wed Apr 8 08:05:04 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 533452AD012; Wed, 8 Apr 2020 08:05:04 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xxdr1rhdz3PqC; Wed, 8 Apr 2020 08:05:04 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 363F81FFDA; Wed, 8 Apr 2020 08:05:04 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 038854mD017144; Wed, 8 Apr 2020 08:05:04 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 038852Hw017135; Wed, 8 Apr 2020 08:05:02 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202004080805.038852Hw017135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Wed, 8 Apr 2020 08:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359722 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: stable-11 X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 359722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2020 08:05:04 -0000 Author: freqlabs Date: Wed Apr 8 08:05:02 2020 New Revision: 359722 URL: https://svnweb.freebsd.org/changeset/base/359722 Log: MFC r359303 MFOpenZFS: ZVOLs should not be allowed to have children zfs create, receive and rename can bypass this hierarchy rule. Update both userland and kernel module to prevent this issue and use pyzfs unit tests to exercise the ioctls directly. Note: this commit slightly changes zfs_ioc_create() ABI. This allow to differentiate a generic error (EINVAL) from the specific case where we tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT). Reviewed-by: Paul Dagnelie Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Reviewed-by: Tom Caputi Signed-off-by: loli10K Approved by: mav (mentor) openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4 Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Apr 8 08:05:02 2020 (r359722) @@ -140,6 +140,7 @@ typedef enum zfs_error { EZFS_TOOMANY, /* argument list too long */ EZFS_INITIALIZING, /* currently initializing */ EZFS_NO_INITIALIZE, /* no active initialize */ + EZFS_WRONG_PARENT, /* invalid parent dataset (e.g ZVOL) */ EZFS_UNKNOWN } zfs_error_t; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Apr 8 08:05:02 2020 (r359722) @@ -3616,11 +3616,6 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs "no such parent '%s'"), parent); return (zfs_error(hdl, EZFS_NOENT, errbuf)); - case EINVAL: - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "parent '%s' is not a filesystem"), parent); - return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); - case ENOTSUP: zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "pool must be upgraded to set this " Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Apr 8 08:05:02 2020 (r359722) @@ -28,6 +28,8 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright (c) 2018, loli10K . All rights reserved. + * Copyright (c) 2019 Datto Inc. */ #include @@ -3356,6 +3358,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const * - we are resuming a failed receive. */ if (stream_wantsnewfs) { + boolean_t is_volume = drrb->drr_type == DMU_OST_ZVOL; if (!flags->force) { zcmd_free_nvlists(&zc); zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -3373,6 +3376,25 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zc.zc_name); return (zfs_error(hdl, EZFS_EXISTS, errbuf)); } + if (is_volume && strrchr(zc.zc_name, '/') == NULL) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "destination '%s' is the root dataset\n" + "cannot overwrite with a ZVOL"), + zc.zc_name); + return (zfs_error(hdl, EZFS_EXISTS, errbuf)); + } + if (is_volume && + ioctl(hdl->libzfs_fd, ZFS_IOC_DATASET_LIST_NEXT, + &zc) == 0) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "destination has children (eg. %s)\n" + "cannot overwrite with a ZVOL"), + zc.zc_name); + return (zfs_error(hdl, EZFS_WRONG_PARENT, + errbuf)); + } } if ((zhp = zfs_open(hdl, zc.zc_name, @@ -3422,6 +3444,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zfs_close(zhp); } else { + zfs_handle_t *zhp; + /* * Destination filesystem does not exist. Therefore we better * be creating a new filesystem (either from a full backup, or @@ -3448,6 +3472,21 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zcmd_free_nvlists(&zc); return (zfs_error(hdl, EZFS_BADRESTORE, errbuf)); } + + /* validate parent */ + zhp = zfs_open(hdl, zc.zc_name, ZFS_TYPE_DATASET); + if (zhp == NULL) { + zcmd_free_nvlists(&zc); + return (zfs_error(hdl, EZFS_BADRESTORE, errbuf)); + } + if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "parent '%s' is not a filesystem"), zc.zc_name); + zfs_close(zhp); + return (zfs_error(hdl, EZFS_WRONG_PARENT, errbuf)); + } + zfs_close(zhp); newfs = B_TRUE; } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Apr 8 08:05:02 2020 (r359722) @@ -261,6 +261,8 @@ libzfs_error_description(libzfs_handle_t *hdl) case EZFS_NO_INITIALIZE: return (dgettext(TEXT_DOMAIN, "there is no active " "initialization")); + case EZFS_WRONG_PARENT: + return (dgettext(TEXT_DOMAIN, "invalid parent dataset")); case EZFS_UNKNOWN: return (dgettext(TEXT_DOMAIN, "unknown error")); default: @@ -526,6 +528,9 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int err break; case ZFS_ERR_VDEV_TOO_BIG: zfs_verror(hdl, EZFS_VDEV_TOO_BIG, fmt, ap); + break; + case ZFS_ERR_WRONG_PARENT: + zfs_verror(hdl, EZFS_WRONG_PARENT, fmt, ap); break; default: zfs_error_aux(hdl, strerror(error)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Apr 8 08:05:02 2020 (r359722) @@ -28,6 +28,7 @@ * Copyright (c) 2015, STRATO AG, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. + * Copyright (c) 2018, loli10K . All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -905,6 +906,8 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx) dmu_objset_create_arg_t *doca = arg; dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dir_t *pdd; + dsl_dataset_t *parentds; + objset_t *parentos; const char *tail; int error; @@ -926,6 +929,30 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx) } error = dsl_fs_ss_limit_check(pdd, 1, ZFS_PROP_FILESYSTEM_LIMIT, NULL, doca->doca_cred); + if (error != 0) { + dsl_dir_rele(pdd, FTAG); + return (error); + } + + /* can't create below anything but filesystems (eg. no ZVOLs) */ + error = dsl_dataset_hold_obj(pdd->dd_pool, + dsl_dir_phys(pdd)->dd_head_dataset_obj, FTAG, &parentds); + if (error != 0) { + dsl_dir_rele(pdd, FTAG); + return (error); + } + error = dmu_objset_from_ds(parentds, &parentos); + if (error != 0) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(pdd, FTAG); + return (error); + } + if (dmu_objset_type(parentos) != DMU_OST_ZFS) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(pdd, FTAG); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + } + dsl_dataset_rele(parentds, FTAG); dsl_dir_rele(pdd, FTAG); return (error); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Wed Apr 8 08:05:02 2020 (r359722) @@ -27,6 +27,7 @@ * Copyright 2014 HybridCluster. All rights reserved. * Copyright 2016 RackTop Systems. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2018, loli10K . All rights reserved. */ #include @@ -1305,6 +1306,7 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d uint64_t fromguid) { uint64_t val; + uint64_t children; int error; dsl_pool_t *dp = ds->ds_dir->dd_pool; @@ -1326,6 +1328,15 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d if (error != ENOENT) return (error == 0 ? SET_ERROR(EEXIST) : error); + /* must not have children if receiving a ZVOL */ + error = zap_count(dp->dp_meta_objset, + dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, &children); + if (error != 0) + return (error); + if (drba->drba_cookie->drc_drrb->drr_type != DMU_OST_ZFS && + children > 0) + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + /* * Check snapshot limit before receiving. We'll recheck again at the * end, but might as well abort before receiving if we're already over @@ -1459,6 +1470,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) } else if (error == ENOENT) { /* target fs does not exist; must be a full backup or clone */ char buf[ZFS_MAX_DATASET_NAME_LEN]; + objset_t *os; /* * If it's a non-clone incremental, we are missing the @@ -1503,6 +1515,17 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) return (error); } + /* can't recv below anything but filesystems (eg. no ZVOLs) */ + error = dmu_objset_from_ds(ds, &os); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + return (error); + } + if (dmu_objset_type(os) != DMU_OST_ZFS) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + } + if (drba->drba_origin != NULL) { dsl_dataset_t *origin; error = dsl_dataset_hold(dp, drba->drba_origin, @@ -1524,6 +1547,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) } dsl_dataset_rele(origin, FTAG); } + dsl_dataset_rele(ds, FTAG); error = 0; } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Apr 8 08:05:02 2020 (r359722) @@ -26,6 +26,7 @@ * Copyright (c) 2014 Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2018, loli10K . All rights reserved. */ #include @@ -1852,6 +1853,8 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dir_t *dd, *newparent; dsl_valid_rename_arg_t dvra; + dsl_dataset_t *parentds; + objset_t *parentos; const char *mynewname; int error; @@ -1881,6 +1884,29 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) dsl_dir_rele(dd, FTAG); return (SET_ERROR(EEXIST)); } + + /* can't rename below anything but filesystems (eg. no ZVOLs) */ + error = dsl_dataset_hold_obj(newparent->dd_pool, + dsl_dir_phys(newparent)->dd_head_dataset_obj, FTAG, &parentds); + if (error != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + error = dmu_objset_from_ds(parentds, &parentos); + if (error != 0) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + if (dmu_objset_type(parentos) != DMU_OST_ZFS) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + dsl_dataset_rele(parentds, FTAG); ASSERT3U(strnlen(ddra->ddra_newname, ZFS_MAX_DATASET_NAME_LEN), <, ZFS_MAX_DATASET_NAME_LEN); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Apr 8 08:05:02 2020 (r359722) @@ -33,8 +33,8 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 RackTop Systems. - * Copyright (c) 2017 Datto Inc. - * Copyright 2016 Toomas Soome + * Copyright (c) 2018, loli10K . All rights reserved. + * Copyright (c) 2019 Datto Inc. */ /* @@ -3131,8 +3131,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver, ASSERT(zplprops != NULL); + /* parent dataset must be a filesystem */ if (os != NULL && os->os_phys->os_type != DMU_OST_ZFS) - return (SET_ERROR(EINVAL)); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); /* * Pull out creator prop choices, if any. @@ -3208,15 +3209,11 @@ zfs_fill_zplprops(const char *dataset, nvlist_t *creat uint64_t zplver = ZPL_VERSION; objset_t *os = NULL; char parentname[ZFS_MAX_DATASET_NAME_LEN]; - char *cp; spa_t *spa; uint64_t spa_vers; int error; - (void) strlcpy(parentname, dataset, sizeof (parentname)); - cp = strrchr(parentname, '/'); - ASSERT(cp != NULL); - cp[0] = '\0'; + zfs_get_parent(dataset, parentname, sizeof (parentname)); if ((error = spa_open(dataset, &spa, FTAG)) != 0) return (error); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Apr 8 06:06:13 2020 (r359721) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Apr 8 08:05:02 2020 (r359722) @@ -1020,7 +1020,8 @@ typedef enum { ZFS_ERR_DISCARDING_CHECKPOINT, ZFS_ERR_NO_CHECKPOINT, ZFS_ERR_DEVRM_IN_PROGRESS, - ZFS_ERR_VDEV_TOO_BIG + ZFS_ERR_VDEV_TOO_BIG, + ZFS_ERR_WRONG_PARENT, } zfs_errno_t; /* From owner-svn-src-stable-11@freebsd.org Thu Apr 9 06:35:51 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98A3E2AFE5D; Thu, 9 Apr 2020 06:35:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yWcR3Yswz49bf; Thu, 9 Apr 2020 06:35:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 711C586D3; Thu, 9 Apr 2020 06:35:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0396Zpsm047263; Thu, 9 Apr 2020 06:35:51 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0396ZpwM047262; Thu, 9 Apr 2020 06:35:51 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <202004090635.0396ZpwM047262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 9 Apr 2020 06:35:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359738 - stable/11/sys/ufs/ufs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/ufs/ufs X-SVN-Commit-Revision: 359738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 06:35:51 -0000 Author: mckusick Date: Thu Apr 9 06:35:50 2020 New Revision: 359738 URL: https://svnweb.freebsd.org/changeset/base/359738 Log: Revert MFC of 359612 due to reported problems. Modified: stable/11/sys/ufs/ufs/inode.h Modified: stable/11/sys/ufs/ufs/inode.h ============================================================================== --- stable/11/sys/ufs/ufs/inode.h Thu Apr 9 06:32:51 2020 (r359737) +++ stable/11/sys/ufs/ufs/inode.h Thu Apr 9 06:35:50 2020 (r359738) @@ -190,11 +190,10 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) \ - (((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define DOINGSUJ(vp) (((vp)->v_mount->mnt_flag & MNT_SUJ) != 0) -#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & MNT_SUJ) != 0) +#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-stable-11@freebsd.org Thu Apr 9 07:15:28 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F4542B0BCF; Thu, 9 Apr 2020 07:15:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yXV83z0Kz4D7p; Thu, 9 Apr 2020 07:15:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 833978E9F; Thu, 9 Apr 2020 07:15:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0397FSJT072209; Thu, 9 Apr 2020 07:15:28 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0397FSdn072207; Thu, 9 Apr 2020 07:15:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004090715.0397FSdn072207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 9 Apr 2020 07:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359740 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/usr.sbin/syslogd X-SVN-Commit-Revision: 359740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 07:15:28 -0000 Author: ae Date: Thu Apr 9 07:15:27 2020 New Revision: 359740 URL: https://svnweb.freebsd.org/changeset/base/359740 Log: MFC r359327,359328: Add property-based filters for syslogd. Property-based filters allow substring and regular expressions (see re_format(7)) matching against various message attributes. Filter specification starts with '#:' or ':' followed by three comma-separated fields property, operator, "value". Value must be double-quoted. A double quote and backslash must be escaped by a blackslash. Following properties are supported as test value: o msg - body of the message received; o programname - program name sent the message; o hostname - hostname of message's originator; o source - an alias for hostname. Supported operators: o contains - true if filter value is found as a substring of property; o isequal - true if filter value is equal to property; o startswith - true if property starts with filter value; o regex - true if property matches basic regular expression defined in filter value; o ereregex - true if property matches extended regular expression defined in filter value; Operator may be prefixed by '!' to invert compare logic or by 'icase_' to make comparison function case insensitive. Submitted by: Boris N. Lytochkin Relnotes: yes Differential Revision: https://reviews.freebsd.org/D23468 Modified: stable/11/usr.sbin/syslogd/syslog.conf.5 stable/11/usr.sbin/syslogd/syslogd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/syslogd/syslog.conf.5 ============================================================================== --- stable/11/usr.sbin/syslogd/syslog.conf.5 Thu Apr 9 07:11:59 2020 (r359739) +++ stable/11/usr.sbin/syslogd/syslog.conf.5 Thu Apr 9 07:15:27 2020 (r359740) @@ -28,7 +28,7 @@ .\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 1, 2016 +.Dd March 26, 2020 .Dt SYSLOG.CONF 5 .Os .Sh NAME @@ -44,9 +44,10 @@ file is the configuration file for the program. It consists of blocks of lines separated by -.Em program -and +.Em program , .Em hostname +or +.Em property-based filter specifications (separations appear alone on their lines), with each line containing two fields: the .Em selector @@ -154,14 +155,16 @@ values specified to the library routine. .Pp Each block of lines is separated from the previous block by a -.Em program -or +.Em program , .Em hostname +or +.Em property-based filter specification. A block will only log messages corresponding to the most recent -.Em program -and +.Em program , .Em hostname +and +.Em property-based filter specifications given. Thus, with a block which selects .Ql ppp @@ -236,11 +239,24 @@ As for program specifications, multiple comma-separate values may be specified for hostname specifications. .Pp A -.Em program +.Em property-based filter +specification is a line beginning with +.Ql #: or +.Ql \&: +and the following blocks will be applied only when filter value +matches given filter propertie's value. See +.Sx PROPERTY-BASED FILTERS +section for more details. +.Pp +A +.Em program , .Em hostname -specification may be reset by giving the program or hostname as -.Ql * . +or +.Em property-based filter +specification may be reset by giving +.Ql * +as an argument. .Pp See .Xr syslog 3 @@ -434,6 +450,78 @@ in this case preceding is removed and .Ql # is treated as an ordinary character. +.Sh PROPERTY-BASED FILTERS +.Em program , +.Em hostname +specifications performs exact match filtering against explicit field only. +.Em Property-based filters +feature substring and regular expressions (see +.Xr re_format 7 ) +matching against various message attributes. +Filter specification starts with +.Ql #: +or +.Ql \&: +followed by three comma-separated fields +.Em property , operator , \&"value\&" . +Value must be double-quoted. A double quote and backslash must be escaped by +a backslash. +.Pp +Following +.Em properties +are supported as test value: +.Pp +.Bl -bullet -compact +.It +.Ql msg +- body of the message received. +.It +.Ql programname +- program name sent the message +.It +.Ql hostname +- hostname of message's originator +.It +.Ql source +- an alias for hostname +.El +.Pp +Operator specifies a comparison function between +.Em propertie's + value against filter's value. +Possible operators: +.Pp +.Bl -bullet -compact +.It +.Ql contains +- true if filter value is found as a substring of +.Em property +.It +.Ql isequal +- true if filter value is equal to +.Em property +.It +.Ql startswith +- true if property starts with filter value +.It +.Ql regex +- true if property matches basic regular expression defined in filter value +.It +.Ql ereregex +- true if property matches extended regular expression defined in filter value +.El +.Pp +Operator may be prefixed by +.Pp +.Bl -bullet -compact +.It +.Ql \&! +- to invert compare logic +.It +.Ql icase_ +- to make comparison function case insensitive +.El +.Pp .Sh IMPLEMENTATION NOTES The .Dq kern @@ -503,6 +591,21 @@ console.* /var/log/console.log # Log ipfw messages without syncing after every message. !ipfw *.* -/var/log/ipfw + +# Log ipfw messages with "Deny" in the message body. +:msg, contains, ".*Deny.*" +*.* /var/log/ipfw.deny + +# Reset program name filtering +!* + +# Log messages from bird or bird6 into one file +:processname, regex, "^bird6?$" +*.* /var/log/bird-all.log + +# Log messages from servers in racks 10-19 in multiple locations, case insensitive +:hostname, icase_ereregex, "^server-(dcA|podB|cdn)-rack1[0-9]{2}\\..*" +*.* /var/log/racks10..19.log .Ed .Sh SEE ALSO .Xr syslog 3 , Modified: stable/11/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.c Thu Apr 9 07:11:59 2020 (r359739) +++ stable/11/usr.sbin/syslogd/syslogd.c Thu Apr 9 07:15:27 2020 (r359740) @@ -141,6 +141,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "pathnames.h" #include "ttymsg.h" @@ -212,6 +213,37 @@ struct logtime { #define RFC3164_DATEFMT "%b %e %H:%M:%S" /* + * This structure holds a property-based filter + */ + +struct prop_filter { + uint8_t prop_type; +#define PROP_TYPE_NOOP 0 +#define PROP_TYPE_MSG 1 +#define PROP_TYPE_HOSTNAME 2 +#define PROP_TYPE_PROGNAME 3 + + uint8_t cmp_type; +#define PROP_CMP_CONTAINS 1 +#define PROP_CMP_EQUAL 2 +#define PROP_CMP_STARTS 3 +#define PROP_CMP_REGEX 4 + + uint16_t cmp_flags; +#define PROP_FLAG_EXCLUDE (1 << 0) +#define PROP_FLAG_ICASE (1 << 1) + + union { + char *p_strval; + regex_t *p_re; + } pflt_uniptr; +#define pflt_strval pflt_uniptr.p_strval +#define pflt_re pflt_uniptr.p_re + + size_t pflt_strlen; +}; + +/* * This structure represents the files that will have log * copies printed. * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY @@ -230,6 +262,7 @@ struct filed { #define PRI_EQ 0x2 #define PRI_GT 0x4 char *f_program; /* program this applies to */ + struct prop_filter *f_prop_filter; /* property-based filter */ union { char f_uname[MAXUNAMES][MAXLOGNAME]; struct { @@ -376,7 +409,8 @@ static int allowaddr(char *); static int addfile(struct filed *); static int addpeer(struct peer *); static int addsock(struct sockaddr *, socklen_t, struct socklist *); -static struct filed *cfline(const char *, const char *, const char *); +static struct filed *cfline(const char *, const char *, const char *, + const char *); static const char *cvthname(struct sockaddr *); static void deadq_enter(pid_t, const char *); static int deadq_remove(struct deadq_entry *); @@ -402,6 +436,10 @@ static int socklist_recv_sock(struct socklist *); static int socklist_recv_signal(struct socklist *); static void sighandler(int); static int skip_message(const char *, const char *, int); +static int evaluate_prop_filter(const struct prop_filter *filter, + const char *value); +static int prop_filter_compile(struct prop_filter *pfilter, + char *filterstr); static void parsemsg(const char *, char *); static void printsys(char *); static int p_open(const char *, pid_t *); @@ -1423,6 +1461,69 @@ skip_message(const char *name, const char *spec, int c } /* + * Match some property of the message against a filter. + * Return a non-0 value if the message must be ignored + * based on the filter. + */ +static int +evaluate_prop_filter(const struct prop_filter *filter, const char *value) +{ + const char *s = NULL; + const int exclude = ((filter->cmp_flags & PROP_FLAG_EXCLUDE) > 0); + size_t valuelen; + + if (value == NULL) + return (-1); + + if (filter->cmp_type == PROP_CMP_REGEX) { + if (regexec(filter->pflt_re, value, 0, NULL, 0) == 0) + return (exclude); + else + return (!exclude); + } + + valuelen = strlen(value); + + /* a shortcut for equal with different length is always false */ + if (filter->cmp_type == PROP_CMP_EQUAL && + valuelen != filter->pflt_strlen) + return (!exclude); + + if (filter->cmp_flags & PROP_FLAG_ICASE) + s = strcasestr(value, filter->pflt_strval); + else + s = strstr(value, filter->pflt_strval); + + /* + * PROP_CMP_CONTAINS true if s + * PROP_CMP_STARTS true if s && s == value + * PROP_CMP_EQUAL true if s && s == value && + * valuelen == filter->pflt_strlen + * (and length match is checked + * already) + */ + + switch (filter->cmp_type) { + case PROP_CMP_STARTS: + case PROP_CMP_EQUAL: + if (s != value) + return (!exclude); + /* FALLTHROUGH */ + case PROP_CMP_CONTAINS: + if (s) + return (exclude); + else + return (!exclude); + break; + default: + /* unknown cmp_type */ + break; + } + + return (-1); +} + +/* * Logs a message to the appropriate log files, users, etc. based on the * priority. Log messages are always formatted according to RFC 3164, * even if they were in RFC 5424 format originally, The MSGID and @@ -1513,6 +1614,30 @@ logmsg(int pri, const struct logtime *timestamp, const f->f_program, 1)) continue; + /* skip messages if a property does not match filter */ + if (f->f_prop_filter != NULL && + f->f_prop_filter->prop_type != PROP_TYPE_NOOP) { + switch (f->f_prop_filter->prop_type) { + case PROP_TYPE_MSG: + if (evaluate_prop_filter(f->f_prop_filter, + msg)) + continue; + break; + case PROP_TYPE_HOSTNAME: + if (evaluate_prop_filter(f->f_prop_filter, + hostname)) + continue; + break; + case PROP_TYPE_PROGNAME: + if (evaluate_prop_filter(f->f_prop_filter, + app_name == NULL ? "" : app_name)) + continue; + break; + default: + continue; + } + } + /* skip message to console if it has already been printed */ if (f->f_type == F_CONSOLE && (flags & IGN_CONS)) continue; @@ -2202,6 +2327,7 @@ readconfigfile(FILE *cf, int allow_includes) char host[MAXHOSTNAMELEN]; char prog[LINE_MAX]; char file[MAXPATHLEN]; + char pfilter[LINE_MAX]; char *p, *tmp; int i, nents; size_t include_len; @@ -2212,6 +2338,7 @@ readconfigfile(FILE *cf, int allow_includes) include_len = sizeof(include_str) -1; (void)strlcpy(host, "*", sizeof(host)); (void)strlcpy(prog, "*", sizeof(prog)); + (void)strlcpy(pfilter, "*", sizeof(pfilter)); while (fgets(cline, sizeof(cline), cf) != NULL) { /* * check for end-of-section, comments, strip off trailing @@ -2260,7 +2387,7 @@ readconfigfile(FILE *cf, int allow_includes) } if (*p == '#') { p++; - if (*p != '!' && *p != '+' && *p != '-') + if (*p == '\0' || strchr("!+-:", *p) == NULL) continue; } if (*p == '+' || *p == '-') { @@ -2297,6 +2424,17 @@ readconfigfile(FILE *cf, int allow_includes) prog[i] = 0; continue; } + if (*p == ':') { + p++; + while (isspace(*p)) + p++; + if ((!*p) || (*p == '*')) { + (void)strlcpy(pfilter, "*", sizeof(pfilter)); + continue; + } + (void)strlcpy(pfilter, p, sizeof(pfilter)); + continue; + } for (p = cline + 1; *p != '\0'; p++) { if (*p != '#') continue; @@ -2310,7 +2448,7 @@ readconfigfile(FILE *cf, int allow_includes) } for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--) cline[i] = '\0'; - f = cfline(cline, prog, host); + f = cfline(cline, prog, host, pfilter); if (f != NULL) addfile(f); free(f); @@ -2404,17 +2542,31 @@ init(int signo) STAILQ_REMOVE_HEAD(&fhead, next); free(f->f_program); free(f->f_host); + if (f->f_prop_filter) { + switch (f->f_prop_filter->cmp_type) { + case PROP_CMP_REGEX: + regfree(f->f_prop_filter->pflt_re); + free(f->f_prop_filter->pflt_re); + break; + case PROP_CMP_CONTAINS: + case PROP_CMP_EQUAL: + case PROP_CMP_STARTS: + free(f->f_prop_filter->pflt_strval); + break; + } + free(f->f_prop_filter); + } free(f); } /* open the configuration file */ if ((cf = fopen(ConfFile, "r")) == NULL) { dprintf("cannot open %s\n", ConfFile); - f = cfline("*.ERR\t/dev/console", "*", "*"); + f = cfline("*.ERR\t/dev/console", "*", "*", "*"); if (f != NULL) addfile(f); free(f); - f = cfline("*.PANIC\t*", "*", "*"); + f = cfline("*.PANIC\t*", "*", "*", "*"); if (f != NULL) addfile(f); free(f); @@ -2515,19 +2667,165 @@ init(int signo) } /* + * Compile property-based filter. + * Returns 0 on success, -1 otherwise. + */ +static int +prop_filter_compile(struct prop_filter *pfilter, char *filter) +{ + char *filter_endpos, *p; + char **ap, *argv[2] = {NULL, NULL}; + int re_flags = REG_NOSUB; + int escaped; + + bzero(pfilter, sizeof(struct prop_filter)); + + /* + * Here's some filter examples mentioned in syslog.conf(5) + * 'msg, contains, ".*Deny.*"' + * 'processname, regex, "^bird6?$"' + * 'hostname, icase_ereregex, "^server-(dcA|podB)-rack1[0-9]{2}\\..*"' + */ + + /* + * Split filter into 3 parts: property name (argv[0]), + * cmp type (argv[1]) and lvalue for comparison (filter). + */ + for (ap = argv; (*ap = strsep(&filter, ", \t\n")) != NULL;) { + if (**ap != '\0') + if (++ap >= &argv[2]) + break; + } + + if (argv[0] == NULL || argv[1] == NULL) { + logerror("filter parse error"); + return (-1); + } + + /* fill in prop_type */ + if (strcasecmp(argv[0], "msg") == 0) + pfilter->prop_type = PROP_TYPE_MSG; + else if(strcasecmp(argv[0], "hostname") == 0) + pfilter->prop_type = PROP_TYPE_HOSTNAME; + else if(strcasecmp(argv[0], "source") == 0) + pfilter->prop_type = PROP_TYPE_HOSTNAME; + else if(strcasecmp(argv[0], "programname") == 0) + pfilter->prop_type = PROP_TYPE_PROGNAME; + else { + logerror("unknown property"); + return (-1); + } + + /* full in cmp_flags (i.e. !contains, icase_regex, etc.) */ + if (*argv[1] == '!') { + pfilter->cmp_flags |= PROP_FLAG_EXCLUDE; + argv[1]++; + } + if (strncasecmp(argv[1], "icase_", (sizeof("icase_") - 1)) == 0) { + pfilter->cmp_flags |= PROP_FLAG_ICASE; + argv[1] += sizeof("icase_") - 1; + } + + /* fill in cmp_type */ + if (strcasecmp(argv[1], "contains") == 0) + pfilter->cmp_type = PROP_CMP_CONTAINS; + else if (strcasecmp(argv[1], "isequal") == 0) + pfilter->cmp_type = PROP_CMP_EQUAL; + else if (strcasecmp(argv[1], "startswith") == 0) + pfilter->cmp_type = PROP_CMP_STARTS; + else if (strcasecmp(argv[1], "regex") == 0) + pfilter->cmp_type = PROP_CMP_REGEX; + else if (strcasecmp(argv[1], "ereregex") == 0) { + pfilter->cmp_type = PROP_CMP_REGEX; + re_flags |= REG_EXTENDED; + } else { + logerror("unknown cmp function"); + return (-1); + } + + /* + * Handle filter value + */ + + /* ' ".*Deny.*"' */ + /* remove leading whitespace and check for '"' next character */ + filter += strspn(filter, ", \t\n"); + if (*filter != '"' || strlen(filter) < 3) { + logerror("property value parse error"); + return (-1); + } + filter++; + + /* '.*Deny.*"' */ + /* process possible backslash (\") escaping */ + escaped = 0; + filter_endpos = filter; + for (p = filter; *p != '\0'; p++) { + if (*p == '\\' && !escaped) { + escaped = 1; + /* do not shift filter_endpos */ + continue; + } + if (*p == '"' && !escaped) { + p++; + break; + } + /* we've seen some esc symbols, need to compress the line */ + if (filter_endpos != p) + *filter_endpos = *p; + + filter_endpos++; + escaped = 0; + } + + *filter_endpos = '\0'; + /* '.*Deny.*' */ + + /* We should not have anything but whitespace left after closing '"' */ + if (*p != '\0' && strspn(p, " \t\n") != strlen(p)) { + logerror("property value parse error"); + return (-1); + } + + if (pfilter->cmp_type == PROP_CMP_REGEX) { + pfilter->pflt_re = calloc(1, sizeof(*pfilter->pflt_re)); + if (pfilter->pflt_re == NULL) { + logerror("RE calloc() error"); + free(pfilter->pflt_re); + return (-1); + } + if (pfilter->cmp_flags & PROP_FLAG_ICASE) + re_flags |= REG_ICASE; + if (regcomp(pfilter->pflt_re, filter, re_flags) != 0) { + logerror("RE compilation error"); + free(pfilter->pflt_re); + return (-1); + } + } else { + pfilter->pflt_strval = strdup(filter); + pfilter->pflt_strlen = strlen(filter); + } + + return (0); + +} + +/* * Crack a configuration file line */ static struct filed * -cfline(const char *line, const char *prog, const char *host) +cfline(const char *line, const char *prog, const char *host, + const char *pfilter) { struct filed *f; struct addrinfo hints, *res; int error, i, pri, syncfile; const char *p, *q; - char *bp; + char *bp, *pfilter_dup; char buf[MAXLINE], ebuf[100]; - dprintf("cfline(\"%s\", f, \"%s\", \"%s\")\n", line, prog, host); + dprintf("cfline(\"%s\", f, \"%s\", \"%s\", \"%s\")\n", line, prog, + host, pfilter); f = calloc(1, sizeof(*f)); if (f == NULL) { @@ -2564,6 +2862,27 @@ cfline(const char *line, const char *prog, const char if (f->f_program == NULL) { logerror("strdup"); exit(1); + } + } + + if (pfilter) { + f->f_prop_filter = calloc(1, sizeof(*(f->f_prop_filter))); + if (f->f_prop_filter == NULL) { + logerror("pfilter calloc"); + exit(1); + } + if (*pfilter == '*') + f->f_prop_filter->prop_type = PROP_TYPE_NOOP; + else { + pfilter_dup = strdup(pfilter); + if (pfilter_dup == NULL) { + logerror("strdup"); + exit(1); + } + if (prop_filter_compile(f->f_prop_filter, pfilter_dup)) { + logerror("filter compile error"); + exit(1); + } } } From owner-svn-src-stable-11@freebsd.org Thu Apr 9 15:30:21 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB35B2BD37E; Thu, 9 Apr 2020 15:30:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ylT9534bz3FWY; Thu, 9 Apr 2020 15:30:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A89B6EEE9; Thu, 9 Apr 2020 15:30:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039FUL2n074759; Thu, 9 Apr 2020 15:30:21 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039FUL0Q074758; Thu, 9 Apr 2020 15:30:21 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004091530.039FUL0Q074758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Thu, 9 Apr 2020 15:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359746 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 359746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 15:30:21 -0000 Author: eugen Date: Thu Apr 9 15:30:21 2020 New Revision: 359746 URL: https://svnweb.freebsd.org/changeset/base/359746 Log: net80211: fix another possible panic for some drivers This change fixes another case for panic missed in r343035 and seen with run(4)-based system. This is direct commit to stable/11 because r306591 could not be merged due to differences in KPI. Note that stable/12 has this problem fixed already. Modified: stable/11/sys/net80211/ieee80211_amrr.c Modified: stable/11/sys/net80211/ieee80211_amrr.c ============================================================================== --- stable/11/sys/net80211/ieee80211_amrr.c Thu Apr 9 14:44:46 2020 (r359745) +++ stable/11/sys/net80211/ieee80211_amrr.c Thu Apr 9 15:30:21 2020 (r359746) @@ -409,6 +409,9 @@ amrr_tx_update(const struct ieee80211vap *vap, const s struct ieee80211_amrr_node *amn = ni->ni_rctls; int txcnt = *(int *)arg1, success = *(int *)arg2, retrycnt = *(int *)arg3; + if (!amn) + return; + amn->amn_txcnt = txcnt; amn->amn_success = success; amn->amn_retrycnt = retrycnt; From owner-svn-src-stable-11@freebsd.org Thu Apr 9 15:58:08 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 216092BE30A; Thu, 9 Apr 2020 15:58:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ym5D02VLz3HmN; Thu, 9 Apr 2020 15:58:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC1EEF4CF; Thu, 9 Apr 2020 15:58:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039Fw74c093472; Thu, 9 Apr 2020 15:58:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039Fw7em093468; Thu, 9 Apr 2020 15:58:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091558.039Fw7em093468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 15:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359748 - in stable: 11/lib/clang 11/share/mk 11/tools/build/options 12/lib/clang 12/share/mk 12/tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/clang 11/share/mk 11/tools/build/options 12/lib/clang 12/share/mk 12/tools/build/options X-SVN-Commit-Revision: 359748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 15:58:08 -0000 Author: kevans Date: Thu Apr 9 15:58:06 2020 New Revision: 359748 URL: https://svnweb.freebsd.org/changeset/base/359748 Log: MFC r359644: llvm: add a build knob for enabling assertions For head/, this will remain eternally default-on to maintain the status quo. For stable/ branches, it should be flipped to default-off to maintain the status quo. There's value in being able to flip it one way or the other easily on head or stable branches, whether you want to gain some performance back on head/ (for machines there's little chance you'll actually hit an assertion) or potentially diagnose a problem with the version of llvm on an older branch. Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going forward, they will instead have the default of LLVM_ASSERTIONS flipped. [MFC note: that last comment just happened for these two branches] Added: stable/11/tools/build/options/WITHOUT_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS stable/11/tools/build/options/WITH_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS Modified: stable/11/lib/clang/llvm.build.mk stable/11/share/mk/src.opts.mk Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/tools/build/options/WITHOUT_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS stable/12/tools/build/options/WITH_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS Modified: stable/12/lib/clang/llvm.build.mk stable/12/share/mk/src.opts.mk Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/clang/llvm.build.mk ============================================================================== --- stable/11/lib/clang/llvm.build.mk Thu Apr 9 15:33:13 2020 (r359747) +++ stable/11/lib/clang/llvm.build.mk Thu Apr 9 15:58:06 2020 (r359748) @@ -17,7 +17,9 @@ CFLAGS+= -I${LLVM_SRCS}/include CFLAGS+= -DLLVM_BUILD_GLOBAL_ISEL CFLAGS+= -D__STDC_LIMIT_MACROS CFLAGS+= -D__STDC_CONSTANT_MACROS +.if ${MK_LLVM_ASSERTIONS} == "no" CFLAGS+= -DNDEBUG +.endif TARGET_ARCH?= ${MACHINE_ARCH} BUILD_ARCH?= ${MACHINE_ARCH} Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Thu Apr 9 15:33:13 2020 (r359747) +++ stable/11/share/mk/src.opts.mk Thu Apr 9 15:58:06 2020 (r359748) @@ -197,6 +197,7 @@ __DEFAULT_NO_OPTIONS = \ HESIOD \ LIBSOFT \ LINT \ + LLVM_ASSERTIONS \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ LOADER_VERBOSE \ Copied: stable/11/tools/build/options/WITHOUT_LLVM_ASSERTIONS (from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LLVM_ASSERTIONS Thu Apr 9 15:58:06 2020 (r359748, copy of r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to disable debugging assertions in LLVM. Copied: stable/11/tools/build/options/WITH_LLVM_ASSERTIONS (from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LLVM_ASSERTIONS Thu Apr 9 15:58:06 2020 (r359748, copy of r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to enable debugging assertions in LLVM. From owner-svn-src-stable-11@freebsd.org Thu Apr 9 16:02:21 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11B392BE572; Thu, 9 Apr 2020 16:02:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ymB46WNPz3JQS; Thu, 9 Apr 2020 16:02:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DADC3F6A7; Thu, 9 Apr 2020 16:02:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039G2Ki6098739; Thu, 9 Apr 2020 16:02:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039G2K9w098737; Thu, 9 Apr 2020 16:02:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091602.039G2K9w098737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 16:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359749 - in stable: 11/contrib/openbsm/bin/auditreduce 12/contrib/openbsm/bin/auditreduce X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/openbsm/bin/auditreduce 12/contrib/openbsm/bin/auditreduce X-SVN-Commit-Revision: 359749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 16:02:21 -0000 Author: kevans Date: Thu Apr 9 16:02:20 2020 New Revision: 359749 URL: https://svnweb.freebsd.org/changeset/base/359749 Log: MFV r359401: OpenBSM: import ee79d73e8df5: auditreduce: add a zone filter This allows one to select audit records that match a -z zone glob. Modified: stable/11/contrib/openbsm/bin/auditreduce/auditreduce.1 stable/11/contrib/openbsm/bin/auditreduce/auditreduce.c stable/11/contrib/openbsm/bin/auditreduce/auditreduce.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/openbsm/bin/auditreduce/auditreduce.1 stable/12/contrib/openbsm/bin/auditreduce/auditreduce.c stable/12/contrib/openbsm/bin/auditreduce/auditreduce.h Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/openbsm/bin/auditreduce/auditreduce.1 ============================================================================== --- stable/11/contrib/openbsm/bin/auditreduce/auditreduce.1 Thu Apr 9 15:58:06 2020 (r359748) +++ stable/11/contrib/openbsm/bin/auditreduce/auditreduce.1 Thu Apr 9 16:02:20 2020 (r359749) @@ -25,7 +25,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 24, 2004 +.Dd February 20, 2020 .Dt AUDITREDUCE 1 .Os .Sh NAME @@ -47,6 +47,7 @@ .Op Fl r Ar ruid .Op Fl u Ar auid .Op Fl v +.Op Fl z Ar zone .Op Ar .Sh DESCRIPTION The @@ -129,6 +130,10 @@ Select records with the given real user ID or name. Select records with the given audit ID. .It Fl v Invert sense of matching, to select records that do not match. +.It Fl z Ar zone +Select records from the given zone(s). +.Ar zone +is a glob for zones to match. .El .Sh EXAMPLES To select all records associated with effective user ID root from the audit Modified: stable/11/contrib/openbsm/bin/auditreduce/auditreduce.c ============================================================================== --- stable/11/contrib/openbsm/bin/auditreduce/auditreduce.c Thu Apr 9 15:58:06 2020 (r359748) +++ stable/11/contrib/openbsm/bin/auditreduce/auditreduce.c Thu Apr 9 16:02:20 2020 (r359749) @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -83,6 +84,7 @@ static int p_egid; /* Effective group id. */ static int p_rgid; /* Real group id. */ static int p_ruid; /* Real user id. */ static int p_subid; /* Subject id. */ +static const char *p_zone; /* Zone. */ /* * Maintain a dynamically sized array of events for -m @@ -103,6 +105,8 @@ static char *p_sockobj = NULL; static uint32_t opttochk = 0; +static int select_zone(const char *zone, uint32_t *optchkd); + static void parse_regexp(char *re_string) { @@ -175,6 +179,7 @@ usage(const char *msg) fprintf(stderr, "\t-r : real user\n"); fprintf(stderr, "\t-u : audit user\n"); fprintf(stderr, "\t-v : select non-matching records\n"); + fprintf(stderr, "\t-z : zone name\n"); exit(EX_USAGE); } @@ -482,6 +487,21 @@ select_subj32(tokenstr_t tok, uint32_t *optchkd) } /* + * Check if the given zone matches the selection criteria. + */ +static int +select_zone(const char *zone, uint32_t *optchkd) +{ + + SETOPT((*optchkd), OPT_z); + if (ISOPTSET(opttochk, OPT_z) && p_zone != NULL) { + if (fnmatch(p_zone, zone, FNM_PATHNAME) != 0) + return (0); + } + return (1); +} + +/* * Read each record from the audit trail. Check if it is selected after * passing through each of the options */ @@ -548,6 +568,10 @@ select_records(FILE *fp) tok_hdr32_copy, &optchkd); break; + case AUT_ZONENAME: + selected = select_zone(tok.tt.zonename.zonename, &optchkd); + break; + default: break; } @@ -614,7 +638,7 @@ main(int argc, char **argv) converr = NULL; - while ((ch = getopt(argc, argv, "Aa:b:c:d:e:f:g:j:m:o:r:u:v")) != -1) { + while ((ch = getopt(argc, argv, "Aa:b:c:d:e:f:g:j:m:o:r:u:vz:")) != -1) { switch(ch) { case 'A': SETOPT(opttochk, OPT_A); @@ -766,6 +790,11 @@ main(int argc, char **argv) case 'v': SETOPT(opttochk, OPT_v); + break; + + case 'z': + p_zone = optarg; + SETOPT(opttochk, OPT_z); break; case '?': Modified: stable/11/contrib/openbsm/bin/auditreduce/auditreduce.h ============================================================================== --- stable/11/contrib/openbsm/bin/auditreduce/auditreduce.h Thu Apr 9 15:58:06 2020 (r359748) +++ stable/11/contrib/openbsm/bin/auditreduce/auditreduce.h Thu Apr 9 16:02:20 2020 (r359749) @@ -57,6 +57,7 @@ struct re_entry { #define OPT_u 0x00010000 #define OPT_A 0x00020000 #define OPT_v 0x00040000 +#define OPT_z 0x00080000 #define FILEOBJ "file" #define MSGQIDOBJ "msgqid" From owner-svn-src-stable-11@freebsd.org Thu Apr 9 16:24:58 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5110C2BED32; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ymhB1RJBz3Lh1; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C1E4FA94; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039GOwxm012886; Thu, 9 Apr 2020 16:24:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039GOwaO012885; Thu, 9 Apr 2020 16:24:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091624.039GOwaO012885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 16:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359750 - in stable: 11/share/man/man5 12/share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/share/man/man5 12/share/man/man5 X-SVN-Commit-Revision: 359750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 16:24:58 -0000 Author: kevans Date: Thu Apr 9 16:24:57 2020 New Revision: 359750 URL: https://svnweb.freebsd.org/changeset/base/359750 Log: MFC (effectively) r359645: src.conf(5): re-roll after LLVM_ASSERTIONS On stable/12, this ends up including just a couple other things that src.conf(5) hadn't been regenerated for. Modified: stable/11/share/man/man5/src.conf.5 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/share/man/man5/src.conf.5 Directory Properties: stable/12/ (props changed) stable/12/contrib/llvm-project/clang/ (props changed) stable/12/contrib/llvm-project/compiler-rt/ (props changed) stable/12/contrib/llvm-project/libcxx/ (props changed) stable/12/contrib/llvm-project/libunwind/ (props changed) stable/12/contrib/llvm-project/lld/ (props changed) stable/12/contrib/llvm-project/lldb/ (props changed) stable/12/contrib/llvm-project/llvm/ (props changed) stable/12/contrib/llvm-project/openmp/ (props changed) Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Thu Apr 9 16:02:20 2020 (r359749) +++ stable/11/share/man/man5/src.conf.5 Thu Apr 9 16:24:57 2020 (r359750) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 28, 2019 +.Dd April 9, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -991,6 +991,8 @@ Set to use LLVM's LLD as the system linker, instead of .Pp This is a default setting on arm64/aarch64. +.It Va WITH_LLVM_ASSERTIONS +Set to enable debugging assertions in LLVM. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 From owner-svn-src-stable-11@freebsd.org Thu Apr 9 20:38:45 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF8B327E57B; Thu, 9 Apr 2020 20:38:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ytK15twDz4FdL; Thu, 9 Apr 2020 20:38:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6F961AB02; Thu, 9 Apr 2020 20:38:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039KcjYj072113; Thu, 9 Apr 2020 20:38:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039KcaQg072060; Thu, 9 Apr 2020 20:38:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004092038.039KcaQg072060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 20:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359754 - in stable/11: bin/sh cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool contrib/bmake contrib/ipfilter contrib/ipfilter/tools contrib/ntp/include contrib/ntp/... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: bin/sh cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool contrib/bmake contrib/ipfilter contrib/ipfilter/tools contrib/ntp/include contrib/ntp/ntpd contrib/tcsh contrib... X-SVN-Commit-Revision: 359754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 20:38:45 -0000 Author: kevans Date: Thu Apr 9 20:38:36 2020 New Revision: 359754 URL: https://svnweb.freebsd.org/changeset/base/359754 Log: MFC -fno-common fixes: r359389, r359394, r359397-r359399, r359403-r359404, r359406, r359413-r359416, r359425, r359427, r359432-r359433, r359443, r359675-r359677 Note: this is not necessarily a complete fix to get these programs to build with -fno-common applied. r359389: config(8): fixes for -fno-common Move this handful of definitions into main.c, properly declare these as extern in config.h. This fixes the config(8) build with -fno-common. Unexplained in my previous commit to gas, -fno-common will become the default in GCC10 and LLVM11, so it's worth addressing these in advance. r359394: MFV r359393: tcsh: import 6974bc35a5cd This removes an extra variable definition that causes the -fno-common build to fail, which will be a new default in GCC10/LLVM11. r359397: zfs: fix -fno-common issues A similar (or identical?) fix has already landed in OpenZFS. -fno-common will become the default in GCC10/LLVM11. r359398: sh: remove duplicate el definition el is declared extern in myhistedit.h and defined in histedit.c. Remove the duplicate definition in input.c to appease the -fno-common build. -fno-common will become the default in GCC10/LLVM11. r359399: telnet: remove some duplicate definitions, mark terminaltype extern Most of these were already properly declared and defined elsewhere, this is effectively just a minor cleanup that fixes the -fno-common build. -fno-common will become the default in GCC10/LLVM11. r359403: Revert 359399: telnet -fno-common bits There was a large misfire from my local diff that I need to investigate, and this version committed did not build. r359404: Re-apply r359399: telnet -fno-common fix line and auth_level's redefinitions are just extraneous telnetd will #define extern and then include ext.h to allocate storage for all of these extern'd vars; however, two of them are actually defined in libtelnet instead. Instead of doing an #ifdef extern dance around those function pointers, just add an EXTERN macro to make it easier to differentiate by sight which ones will get allocated in globals.c and which ones are defined elsewhere. r359406: telnet: kill off remaining duplicate definition r359413: ipfilter: remove duplicate definition of 'thishost' thishost is already defined in lib/initparse.c; no need for this one. This fixes the ipfilter build with -fno-common. -fno-common will become the default in GCC10/LLVM11. r359414: iscontrol: move definition of vflag/iscsidev to iscontrol.c Mark the declaration extern as these are used elsewhere; this fixes the build with -fno-common. r359415: userboot: mark host_fsops as extern This is already defined elsewhere; mark this declaration extern to the fix the -fno-common build. r359416: systat: remove redundant definition of kd kd is already properly declared in extern.h and defined in main.c, rendering this definition useless. This fixes the -fno-common build. r359425: locate: fix -fno-common build Just a single variable declaration to extern and define elsewhere here, myctype. -fno-common will become a default in GCC10/LLVM11. r359427: fsck_ffs/fsdb: fix -fno-common build This one is also a small list: - 3x duplicate definition (ufs2_zino, returntosingle, nflag) - 5x 'needs extern', 3/5 of which are referenced in fsdb -fno-common will become the default in GCC10/LLVM11. r359432: gdb: compile with -fcommon explicitly As described in the comment, gdb relies on some of the linker magic that happens with -fcommon. I suspect the life expectancy of gdb-in-base is low enough that this isn't worth spending much time addressing, especially given the vintage. Hit it with the -fcommon hammer so that it continues to just work. r359433: bmake: fix -fno-common build debug was declared extern, but debug_file was not; correct this and define debug_file in main.c (as debug is) to fix the -fno-common build. -fno-common will become the default with GCC10/LLVM11. r359443: MFV r359442: bmake: import -fno-common fix build back from upstream sjg@ committed the local patch previously committed upstream; pull it in to vendor/ to ease any potential stress of future imports. r359675: kqueue tests: fix -fno-common build vnode_fd and kqfd are both shared among multiple CU; define them exactly once. In the case of vnode_fd, it was simply the declaration that needed correction. -fno-common will become the default in GCC10/LLVM11. r359676: ntpd: fix build with -fno-common Only a small nit here: psl should be declared extern and defined exactly once. -fno-common will become the default in GCC10/LLVM11. r359677: yp*: fix -fno-common build This is mostly two problems spread out far and wide: - ypldap_process should be declared properly - debug is defined differently in many programs For the latter, just extern it and define it everywhere that actually needs it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the assignment at the beginning of main in favor of defining it properly. -fno-common will become the default in GCC10/LLVM11. Modified: stable/11/bin/sh/input.c stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h stable/11/contrib/bmake/main.c stable/11/contrib/bmake/make.h stable/11/contrib/ipfilter/ipf.h stable/11/contrib/ipfilter/tools/ipnat.c stable/11/contrib/ntp/include/ntp_config.h stable/11/contrib/ntp/ntpd/ntp_config.c stable/11/contrib/tcsh/tc.sig.c stable/11/contrib/telnet/telnetd/ext.h stable/11/contrib/telnet/telnetd/global.c stable/11/contrib/telnet/telnetd/sys_term.c stable/11/contrib/telnet/telnetd/telnetd.c stable/11/gnu/usr.bin/gdb/Makefile.inc stable/11/libexec/ypxfr/ypxfr_main.c stable/11/sbin/fsck_ffs/fsck.h stable/11/sbin/fsck_ffs/gjournal.c stable/11/sbin/fsck_ffs/globs.c stable/11/sbin/fsck_ffs/setup.c stable/11/sbin/fsdb/fsdb.c stable/11/sbin/iscontrol/iscontrol.c stable/11/sbin/iscontrol/iscontrol.h stable/11/stand/userboot/userboot/libuserboot.h stable/11/tests/sys/kqueue/libkqueue/common.h stable/11/tests/sys/kqueue/libkqueue/proc.c stable/11/tests/sys/kqueue/libkqueue/read.c stable/11/tests/sys/kqueue/libkqueue/signal.c stable/11/tests/sys/kqueue/libkqueue/timer.c stable/11/tests/sys/kqueue/libkqueue/user.c stable/11/tests/sys/kqueue/libkqueue/vnode.c stable/11/usr.bin/locate/locate/locate.c stable/11/usr.bin/locate/locate/locate.h stable/11/usr.bin/systat/swap.c stable/11/usr.sbin/config/config.h stable/11/usr.sbin/config/main.c stable/11/usr.sbin/rpc.yppasswdd/yppasswdd_main.c stable/11/usr.sbin/rpc.ypupdated/ypupdated_main.c stable/11/usr.sbin/rpc.ypxfrd/ypxfrd_main.c stable/11/usr.sbin/ypldap/ypldap.c stable/11/usr.sbin/ypldap/ypldap.h stable/11/usr.sbin/ypserv/yp_access.c stable/11/usr.sbin/ypserv/yp_error.c stable/11/usr.sbin/ypserv/yp_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/sh/input.c ============================================================================== --- stable/11/bin/sh/input.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/bin/sh/input.c Thu Apr 9 20:38:36 2020 (r359754) @@ -102,8 +102,6 @@ static struct parsefile basepf = { /* top level input static struct parsefile *parsefile = &basepf; /* current input file */ int whichprompt; /* 1 == PS1, 2 == PS2 */ -EditLine *el; /* cookie for editline package */ - static void pushfile(void); static int preadfd(void); static void popstring(void); Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h Thu Apr 9 20:38:36 2020 (r359754) @@ -33,7 +33,7 @@ extern "C" { void * safe_malloc(size_t size); void nomem(void); -libzfs_handle_t *g_zfs; +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -62,6 +62,8 @@ #include "statcommon.h" +libzfs_handle_t *g_zfs; + static int zpool_do_create(int, char **); static int zpool_do_destroy(int, char **); Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Apr 9 20:38:36 2020 (r359754) @@ -64,7 +64,7 @@ void pool_list_free(zpool_list_t *); int pool_list_count(zpool_list_t *); void pool_list_remove(zpool_list_t *, zpool_handle_t *); -libzfs_handle_t *g_zfs; +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } Modified: stable/11/contrib/bmake/main.c ============================================================================== --- stable/11/contrib/bmake/main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/bmake/main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $ */ +/* $NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -198,6 +198,8 @@ char *progname; /* the program name */ char *makeDependfile; pid_t myPid; int makelevel; + +FILE *debug_file; Boolean forceJobs = FALSE; Modified: stable/11/contrib/bmake/make.h ============================================================================== --- stable/11/contrib/bmake/make.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/bmake/make.h Thu Apr 9 20:38:36 2020 (r359754) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.104 2018/02/12 21:38:09 sjg Exp $ */ +/* $NetBSD: make.h,v 1.105 2020/03/30 02:41:06 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -464,7 +464,7 @@ extern pid_t myPid; * There is one bit per module. It is up to the module what debug * information to print. */ -FILE *debug_file; /* Output written here - default stdout */ +extern FILE *debug_file; /* Output written here - default stdout */ extern int debug; #define DEBUG_ARCH 0x00001 #define DEBUG_COND 0x00002 Modified: stable/11/contrib/ipfilter/ipf.h ============================================================================== --- stable/11/contrib/ipfilter/ipf.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/ipfilter/ipf.h Thu Apr 9 20:38:36 2020 (r359754) @@ -191,7 +191,7 @@ typedef int (* addfunc_t) __P((int, ioctlfunc_t, void typedef int (* copyfunc_t) __P((void *, void *, size_t)); -extern char thishost[]; +extern char thishost[MAXHOSTNAMELEN]; extern char flagset[]; extern u_char flags[]; extern struct ipopt_names ionames[]; Modified: stable/11/contrib/ipfilter/tools/ipnat.c ============================================================================== --- stable/11/contrib/ipfilter/tools/ipnat.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/ipfilter/tools/ipnat.c Thu Apr 9 20:38:36 2020 (r359754) @@ -60,7 +60,6 @@ static const char rcsid[] = "@(#)$Id$"; #define bzero(a,b) memset(a,0,b) #endif int use_inet6 = 0; -char thishost[MAXHOSTNAMELEN]; extern char *optarg; Modified: stable/11/contrib/ntp/include/ntp_config.h ============================================================================== --- stable/11/contrib/ntp/include/ntp_config.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/ntp/include/ntp_config.h Thu Apr 9 20:38:36 2020 (r359754) @@ -280,7 +280,7 @@ typedef struct settrap_parms_tag { * Poll Skew List */ -psl_item psl[17-3+1]; /* values for polls 3-17 */ +extern psl_item psl[17-3+1]; /* values for polls 3-17 */ /* To simplify the runtime code we */ /* don't want to have to special-case */ /* dealing with a default */ Modified: stable/11/contrib/ntp/ntpd/ntp_config.c ============================================================================== --- stable/11/contrib/ntp/ntpd/ntp_config.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/ntp/ntpd/ntp_config.c Thu Apr 9 20:38:36 2020 (r359754) @@ -202,6 +202,8 @@ int cryptosw; /* crypto command called */ extern char *stats_drift_file; /* name of the driftfile */ +psl_item psl[17-3+1]; + #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED /* * backwards compatibility flags Modified: stable/11/contrib/tcsh/tc.sig.c ============================================================================== --- stable/11/contrib/tcsh/tc.sig.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/tcsh/tc.sig.c Thu Apr 9 20:38:36 2020 (r359754) @@ -56,7 +56,6 @@ int alrmcatch_disabled; /* = 0; */ int phup_disabled; /* = 0; */ int pchild_disabled; /* = 0; */ int pintr_disabled; /* = 0; */ -int handle_interrupt; /* = 0; */ int handle_pending_signals(void) Modified: stable/11/contrib/telnet/telnetd/ext.h ============================================================================== --- stable/11/contrib/telnet/telnetd/ext.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/telnet/telnetd/ext.h Thu Apr 9 20:38:36 2020 (r359754) @@ -30,53 +30,57 @@ * $FreeBSD$ */ +#ifndef EXTERN +#define EXTERN extern +#endif + /* * Telnet server variable declarations */ -extern char options[256]; -extern char do_dont_resp[256]; -extern char will_wont_resp[256]; -extern int linemode; /* linemode on/off */ +EXTERN char options[256]; +EXTERN char do_dont_resp[256]; +EXTERN char will_wont_resp[256]; +EXTERN int linemode; /* linemode on/off */ #ifdef LINEMODE -extern int uselinemode; /* what linemode to use (on/off) */ -extern int editmode; /* edit modes in use */ -extern int useeditmode; /* edit modes to use */ -extern int alwayslinemode; /* command line option */ -extern int lmodetype; /* Client support for linemode */ +EXTERN int uselinemode; /* what linemode to use (on/off) */ +EXTERN int editmode; /* edit modes in use */ +EXTERN int useeditmode; /* edit modes to use */ +EXTERN int alwayslinemode; /* command line option */ +EXTERN int lmodetype; /* Client support for linemode */ #endif /* LINEMODE */ -extern int flowmode; /* current flow control state */ -extern int restartany; /* restart output on any character state */ +EXTERN int flowmode; /* current flow control state */ +EXTERN int restartany; /* restart output on any character state */ #ifdef DIAGNOSTICS -extern int diagnostic; /* telnet diagnostic capabilities */ +EXTERN int diagnostic; /* telnet diagnostic capabilities */ #endif /* DIAGNOSTICS */ #ifdef BFTPDAEMON -extern int bftpd; /* behave as bftp daemon */ +EXTERN int bftpd; /* behave as bftp daemon */ #endif /* BFTPDAEMON */ #ifdef AUTHENTICATION -extern int auth_level; +EXTERN int auth_level; #endif -extern slcfun slctab[NSLC + 1]; /* slc mapping table */ +EXTERN slcfun slctab[NSLC + 1]; /* slc mapping table */ -char *terminaltype; +EXTERN char *terminaltype; /* * I/O data buffers, pointers, and counters. */ -extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; +EXTERN char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; -extern char netibuf[BUFSIZ], *netip; +EXTERN char netibuf[BUFSIZ], *netip; -extern char netobuf[BUFSIZ], *nfrontp, *nbackp; -extern char *neturg; /* one past last bye of urgent data */ +EXTERN char netobuf[BUFSIZ], *nfrontp, *nbackp; +EXTERN char *neturg; /* one past last bye of urgent data */ -extern int pcc, ncc; +EXTERN int pcc, ncc; -extern int pty, net; -extern char line[32]; -extern int SYNCHing; /* we are in TELNET SYNCH mode */ +EXTERN int pty, net; +EXTERN char line[32]; +EXTERN int SYNCHing; /* we are in TELNET SYNCH mode */ -extern void +EXTERN void _termstat(void), add_slc(char, char, cc_t), check_slc(void), @@ -133,7 +137,7 @@ extern void tty_binaryin(int), tty_binaryout(int); -extern int +EXTERN int end_slc(unsigned char **), getnpty(void), #ifndef convex @@ -158,7 +162,7 @@ extern int tty_istrapsig(void), tty_linemode(void); -extern void +EXTERN void tty_rspeed(int), tty_setecho(int), tty_setedit(int), @@ -177,7 +181,7 @@ void startslave(char *, int, char *); #ifdef ENCRYPTION extern void (*encrypt_output)(unsigned char *, int); extern int (*decrypt_input)(int); -extern char *nclearto; +EXTERN char *nclearto; #endif /* ENCRYPTION */ @@ -186,7 +190,7 @@ extern char *nclearto; * the relationship between various variables. */ -extern struct { +EXTERN struct { int system, /* what the current time is */ echotoggle, /* last time user entered echo character */ Modified: stable/11/contrib/telnet/telnetd/global.c ============================================================================== --- stable/11/contrib/telnet/telnetd/global.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/telnet/telnetd/global.c Thu Apr 9 20:38:36 2020 (r359754) @@ -44,5 +44,5 @@ __FBSDID("$FreeBSD$"); */ #include "defs.h" -#define extern +#define EXTERN #include "ext.h" Modified: stable/11/contrib/telnet/telnetd/sys_term.c ============================================================================== --- stable/11/contrib/telnet/telnetd/sys_term.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/telnet/telnetd/sys_term.c Thu Apr 9 20:38:36 2020 (r359754) @@ -376,8 +376,6 @@ spcset(int func, cc_t *valp, cc_t **valpp) * * Returns the file descriptor of the opened pty. */ -char line[32]; - int getpty(int *ptynum __unused) { Modified: stable/11/contrib/telnet/telnetd/telnetd.c ============================================================================== --- stable/11/contrib/telnet/telnetd/telnetd.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/contrib/telnet/telnetd/telnetd.c Thu Apr 9 20:38:36 2020 (r359754) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #ifdef AUTHENTICATION #include -int auth_level = 0; #endif #ifdef ENCRYPTION #include Modified: stable/11/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- stable/11/gnu/usr.bin/gdb/Makefile.inc Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/gnu/usr.bin/gdb/Makefile.inc Thu Apr 9 20:38:36 2020 (r359754) @@ -47,6 +47,11 @@ CFLAGS+= -I${CNTRB_GDB}/include CFLAGS+= -I${CNTRB_BU}/bfd CFLAGS+= -I${OBJ_RL:H} +# Some bits here currently rely on some of the linker-merging magic that happens +# with -fcommon. While this is the default right now, explicitly set -fcommon +# so that it continues to build when the default flips. +CFLAGS+= -fcommon + GENSRCS+= nm.h tm.h .if defined(GDB_CROSS_DEBUGGER) Modified: stable/11/libexec/ypxfr/ypxfr_main.c ============================================================================== --- stable/11/libexec/ypxfr/ypxfr_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/libexec/ypxfr/ypxfr_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include "ypxfr_extern.h" +int debug = 1; + char *progname = "ypxfr"; char *yp_dir = _PATH_YP; int _rpcpmstart = 0; @@ -173,8 +175,6 @@ main(int argc, char *argv[]) int remoteport; int interdom = 0; int secure = 0; - - debug = 1; if (!isatty(fileno(stderr))) { openlog("ypxfr", LOG_PID, LOG_DAEMON); Modified: stable/11/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/11/sbin/fsck_ffs/fsck.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/fsck_ffs/fsck.h Thu Apr 9 20:38:36 2020 (r359754) @@ -125,7 +125,7 @@ struct inostat { * Inode state information is contained on per cylinder group lists * which are described by the following structure. */ -struct inostatlist { +extern struct inostatlist { long il_numalloced; /* number of inodes allocated in this cg */ struct inostat *il_stat;/* inostat info for this cylinder group */ } *inostathead; @@ -269,13 +269,13 @@ struct dups { struct dups *next; ufs2_daddr_t dup; }; -struct dups *duplist; /* head of dup list */ -struct dups *muldup; /* end of unique duplicate dup block numbers */ +extern struct dups *duplist; /* head of dup list */ +extern struct dups *muldup; /* end of unique duplicate dup block numbers */ /* * Inode cache data structures. */ -struct inoinfo { +extern struct inoinfo { struct inoinfo *i_nexthash; /* next entry in hash chain */ ino_t i_number; /* inode number of this entry */ ino_t i_parent; /* inode number of parent */ Modified: stable/11/sbin/fsck_ffs/gjournal.c ============================================================================== --- stable/11/sbin/fsck_ffs/gjournal.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/fsck_ffs/gjournal.c Thu Apr 9 20:38:36 2020 (r359754) @@ -91,7 +91,6 @@ static LIST_HEAD(, cgchain) cglist = LIST_HEAD_INITIAL static const char *devnam; static struct uufsd *disk = NULL; static struct fs *fs = NULL; -struct ufs2_dinode ufs2_zino; static void putcgs(void); Modified: stable/11/sbin/fsck_ffs/globs.c ============================================================================== --- stable/11/sbin/fsck_ffs/globs.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/fsck_ffs/globs.c Thu Apr 9 20:38:36 2020 (r359754) @@ -114,6 +114,10 @@ volatile sig_atomic_t got_sigalarm; /* received a SIGA struct ufs1_dinode ufs1_zino; struct ufs2_dinode ufs2_zino; +struct dups *duplist; +struct dups *muldup; +struct inostatlist *inostathead; + void fsckinit(void) { Modified: stable/11/sbin/fsck_ffs/setup.c ============================================================================== --- stable/11/sbin/fsck_ffs/setup.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/fsck_ffs/setup.c Thu Apr 9 20:38:36 2020 (r359754) @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" +struct inoinfo **inphead, **inpsort; + struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) Modified: stable/11/sbin/fsdb/fsdb.c ============================================================================== --- stable/11/sbin/fsdb/fsdb.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/fsdb/fsdb.c Thu Apr 9 20:38:36 2020 (r359754) @@ -70,9 +70,6 @@ usage(void) exit(1); } -int returntosingle; -char nflag; - /* * We suck in lots of fsck code, and just pick & choose the stuff we want. * Modified: stable/11/sbin/iscontrol/iscontrol.c ============================================================================== --- stable/11/sbin/iscontrol/iscontrol.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/iscontrol/iscontrol.c Thu Apr 9 20:38:36 2020 (r359754) @@ -82,6 +82,9 @@ token_t DigestMethods[] = { {0, 0} }; +int vflag; +char *iscsidev; + u_char isid[6 + 6]; /* | Default values Modified: stable/11/sbin/iscontrol/iscontrol.h ============================================================================== --- stable/11/sbin/iscontrol/iscontrol.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/sbin/iscontrol/iscontrol.h Thu Apr 9 20:38:36 2020 (r359754) @@ -149,8 +149,8 @@ int recvpdu(isess_t *sess, pdu_t *pp); int lookup(token_t *tbl, char *m); -int vflag; -char *iscsidev; +extern int vflag; +extern char *iscsidev; void parseArgs(int nargs, char **args, isc_opt_t *op); void parseConfig(FILE *fd, char *key, isc_opt_t *op); Modified: stable/11/stand/userboot/userboot/libuserboot.h ============================================================================== --- stable/11/stand/userboot/userboot/libuserboot.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/stand/userboot/userboot/libuserboot.h Thu Apr 9 20:38:36 2020 (r359754) @@ -43,7 +43,7 @@ extern int userboot_disk_maxunit; extern struct devsw host_dev; /* access to host filesystem */ -struct fs_ops host_fsops; +extern struct fs_ops host_fsops; struct bootinfo; struct preloaded_file; Modified: stable/11/tests/sys/kqueue/libkqueue/common.h ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/common.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/common.h Thu Apr 9 20:38:36 2020 (r359754) @@ -41,7 +41,8 @@ #include extern char *cur_test_id; -int vnode_fd; +extern int vnode_fd; +extern int kqfd; extern char * kevent_to_str(struct kevent *); struct kevent * kevent_get(int); Modified: stable/11/tests/sys/kqueue/libkqueue/proc.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/proc.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/proc.c Thu Apr 9 20:38:36 2020 (r359754) @@ -25,7 +25,6 @@ static int sigusr1_caught = 0; -int kqfd; static void sig_handler(int signum) Modified: stable/11/tests/sys/kqueue/libkqueue/read.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/read.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/read.c Thu Apr 9 20:38:36 2020 (r359754) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int sockfd[2]; static void Modified: stable/11/tests/sys/kqueue/libkqueue/signal.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/signal.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/signal.c Thu Apr 9 20:38:36 2020 (r359754) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; void test_kevent_signal_add(void) Modified: stable/11/tests/sys/kqueue/libkqueue/timer.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/timer.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/timer.c Thu Apr 9 20:38:36 2020 (r359754) @@ -26,7 +26,6 @@ #define MS_TO_US(t) ((t) * THOUSAND) /* Convert milliseconds to microseconds. */ #define US_TO_NS(t) ((t) * THOUSAND) /* Convert microseconds to nanoseconds. */ -int kqfd; /* Get the current time with microsecond precision. Used for * sub-second timing to make some timer tests run faster. Modified: stable/11/tests/sys/kqueue/libkqueue/user.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/user.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/user.c Thu Apr 9 20:38:36 2020 (r359754) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; static void add_and_delete(void) Modified: stable/11/tests/sys/kqueue/libkqueue/vnode.c ============================================================================== --- stable/11/tests/sys/kqueue/libkqueue/vnode.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/tests/sys/kqueue/libkqueue/vnode.c Thu Apr 9 20:38:36 2020 (r359754) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int vnode_fd; void Modified: stable/11/usr.bin/locate/locate/locate.c ============================================================================== --- stable/11/usr.bin/locate/locate/locate.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.bin/locate/locate/locate.c Thu Apr 9 20:38:36 2020 (r359754) @@ -114,6 +114,7 @@ int f_limit; /* limit number of output line u_int counter; /* counter for matches [-c] */ char separator='\n'; /* line separator */ +u_char myctype[UCHAR_MAX + 1]; void usage(void); void statistic(FILE *, char *); Modified: stable/11/usr.bin/locate/locate/locate.h ============================================================================== --- stable/11/usr.bin/locate/locate/locate.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.bin/locate/locate/locate.h Thu Apr 9 20:38:36 2020 (r359754) @@ -63,7 +63,7 @@ define TOLOWER(ch) tolower(ch) #else -u_char myctype[UCHAR_MAX + 1]; +extern u_char myctype[UCHAR_MAX + 1]; #define TOLOWER(ch) (myctype[ch]) #endif Modified: stable/11/usr.bin/systat/swap.c ============================================================================== --- stable/11/usr.bin/systat/swap.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.bin/systat/swap.c Thu Apr 9 20:38:36 2020 (r359754) @@ -54,8 +54,6 @@ static const char sccsid[] = "@(#)swap.c 8.3 (Berkeley #include "systat.h" #include "extern.h" -kvm_t *kd; - static char *header; static long blocksize; static int dlen, odlen; Modified: stable/11/usr.sbin/config/config.h ============================================================================== --- stable/11/usr.sbin/config/config.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/config/config.h Thu Apr 9 20:38:36 2020 (r359754) @@ -43,7 +43,7 @@ struct cfgfile { STAILQ_ENTRY(cfgfile) cfg_next; char *cfg_path; }; -STAILQ_HEAD(, cfgfile) cfgfiles; +extern STAILQ_HEAD(cfgfile_head, cfgfile) cfgfiles; struct file_list { STAILQ_ENTRY(file_list) f_next; @@ -100,8 +100,8 @@ struct config { * in the makerules, etc. machinearch is the global notion of the * MACHINE_ARCH for this MACHINE. */ -char *machinename; -char *machinearch; +extern char *machinename; +extern char *machinearch; /* * For each machine, a set of CPU's may be specified as supported. @@ -112,7 +112,7 @@ struct cputype { SLIST_ENTRY(cputype) cpu_next; }; -SLIST_HEAD(, cputype) cputype; +extern SLIST_HEAD(cputype_head, cputype) cputype; /* * A set of options may also be specified which are like CPU types, @@ -127,7 +127,7 @@ struct opt { SLIST_ENTRY(opt) op_append; }; -SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; +extern SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; struct opt_list { char *o_name; @@ -137,7 +137,7 @@ struct opt_list { SLIST_ENTRY(opt_list) o_next; }; -SLIST_HEAD(, opt_list) otab; +extern SLIST_HEAD(opt_list_head, opt_list) otab; struct envvar { char *env_str; @@ -145,21 +145,21 @@ struct envvar { STAILQ_ENTRY(envvar) envvar_next; }; -STAILQ_HEAD(envvar_head, envvar) envvars; +extern STAILQ_HEAD(envvar_head, envvar) envvars; struct hint { char *hint_name; STAILQ_ENTRY(hint) hint_next; }; -STAILQ_HEAD(hint_head, hint) hints; +extern STAILQ_HEAD(hint_head, hint) hints; struct includepath { char *path; SLIST_ENTRY(includepath) path_next; }; -SLIST_HEAD(, includepath) includepath; +extern SLIST_HEAD(includepath_head, includepath) includepath; /* * Tag present in the kernconf.tmpl template file. It's mandatory for those Modified: stable/11/usr.sbin/config/main.c ============================================================================== --- stable/11/usr.sbin/config/main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/config/main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -70,6 +70,17 @@ static const char rcsid[] = #define CDIR "../compile/" +char *machinename; +char *machinearch; + +struct cfgfile_head cfgfiles; +struct cputype_head cputype; +struct opt_head opt, mkopt, rmopts; +struct opt_list_head otab; +struct envvar_head envvars; +struct hint_head hints; +struct includepath_head includepath; + char * PREFIX; char destdir[MAXPATHLEN]; char srcdir[MAXPATHLEN]; Modified: stable/11/usr.sbin/rpc.yppasswdd/yppasswdd_main.c ============================================================================== --- stable/11/usr.sbin/rpc.yppasswdd/yppasswdd_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/rpc.yppasswdd/yppasswdd_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -81,6 +81,7 @@ static int _rpcfdtype; #define _IDLE 0 #define _SERVED 1 #define _SERVING 2 +int debug; static char _localhost[] = "localhost"; static char _passwd_byname[] = "passwd.byname"; @@ -170,8 +171,6 @@ main(int argc, char *argv[]) char *mastername; char myname[MAXHOSTNAMELEN + 2]; int maxrec = RPC_MAXDATASIZE; - - extern int debug; debug = 1; Modified: stable/11/usr.sbin/rpc.ypupdated/ypupdated_main.c ============================================================================== --- stable/11/usr.sbin/rpc.ypupdated/ypupdated_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/rpc.ypupdated/ypupdated_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -74,6 +74,8 @@ static int _rpcfdtype; extern int _rpcsvcstate; /* Set when a request is serviced */ +int debug; + char *progname = "rpc.ypupdated"; char *yp_dir = "/var/yp/"; Modified: stable/11/usr.sbin/rpc.ypxfrd/ypxfrd_main.c ============================================================================== --- stable/11/usr.sbin/rpc.ypxfrd/ypxfrd_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/rpc.ypxfrd/ypxfrd_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -76,6 +76,8 @@ static int _rpcfdtype; extern int _rpcsvcstate; /* Set when a request is serviced */ +int debug; + char *progname = "rpc.ypxfrd"; char *yp_dir = "/var/yp/"; Modified: stable/11/usr.sbin/ypldap/ypldap.c ============================================================================== --- stable/11/usr.sbin/ypldap/ypldap.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/ypldap/ypldap.c Thu Apr 9 20:38:36 2020 (r359754) @@ -40,6 +40,8 @@ #include "ypldap.h" +enum ypldap_process_type ypldap_process; + __dead2 void usage(void); int check_child(pid_t, const char *); void main_sig_handler(int, short, void *); Modified: stable/11/usr.sbin/ypldap/ypldap.h ============================================================================== --- stable/11/usr.sbin/ypldap/ypldap.h Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/ypldap/ypldap.h Thu Apr 9 20:38:36 2020 (r359754) @@ -47,10 +47,11 @@ struct ypldap_addr { }; TAILQ_HEAD(ypldap_addr_list, ypldap_addr); -enum { +enum ypldap_process_type { PROC_MAIN, PROC_CLIENT -} ypldap_process; +}; +extern enum ypldap_process_type ypldap_process; struct userent { RB_ENTRY(userent) ue_name_node; Modified: stable/11/usr.sbin/ypserv/yp_access.c ============================================================================== --- stable/11/usr.sbin/ypserv/yp_access.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/ypserv/yp_access.c Thu Apr 9 20:38:36 2020 (r359754) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include "tcpd.h" #endif -extern int debug; - static const char *yp_procs[] = { /* NIS v1 */ "ypoldproc_null", Modified: stable/11/usr.sbin/ypserv/yp_error.c ============================================================================== --- stable/11/usr.sbin/ypserv/yp_error.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/ypserv/yp_error.c Thu Apr 9 20:38:36 2020 (r359754) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include "yp_extern.h" -int debug; - extern int _rpcpmstart; extern char *progname; static void __verr(const char *fmt, va_list ap) __printflike(1, 0); Modified: stable/11/usr.sbin/ypserv/yp_main.c ============================================================================== --- stable/11/usr.sbin/ypserv/yp_main.c Thu Apr 9 20:35:35 2020 (r359753) +++ stable/11/usr.sbin/ypserv/yp_main.c Thu Apr 9 20:38:36 2020 (r359754) @@ -87,7 +87,7 @@ extern int _rpc_dtablesize(void); extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "ypserv"; char *yp_dir = _PATH_YP; -/*int debug = 0;*/ +int debug; int do_dns = 0; int resfd; From owner-svn-src-stable-11@freebsd.org Thu Apr 9 20:49:02 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 149C727EB71; Thu, 9 Apr 2020 20:49:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ytXs6mCzz4GGv; Thu, 9 Apr 2020 20:49:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E32791AD01; Thu, 9 Apr 2020 20:49:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039Kn186078351; Thu, 9 Apr 2020 20:49:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039Kn1SV078350; Thu, 9 Apr 2020 20:49:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004092049.039Kn1SV078350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 20:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359755 - in stable: 11/contrib/binutils/gas 12/contrib/binutils/gas X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/binutils/gas 12/contrib/binutils/gas X-SVN-Commit-Revision: 359755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 20:49:02 -0000 Author: kevans Date: Thu Apr 9 20:49:01 2020 New Revision: 359755 URL: https://svnweb.freebsd.org/changeset/base/359755 Log: gas: mark dwarf2_loc_mark_labels as extern Compiling with -fno-common complains as this header's included in multiple compilation units. In fact, the proper definition of dwarf2_loc_mark_labels already exists in dwarf2dbg.c, so simply mark this declaration with extern. Modified: stable/11/contrib/binutils/gas/dwarf2dbg.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/binutils/gas/dwarf2dbg.h Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/binutils/gas/dwarf2dbg.h ============================================================================== --- stable/11/contrib/binutils/gas/dwarf2dbg.h Thu Apr 9 20:38:36 2020 (r359754) +++ stable/11/contrib/binutils/gas/dwarf2dbg.h Thu Apr 9 20:49:01 2020 (r359755) @@ -78,7 +78,7 @@ extern void dwarf2_emit_label (symbolS *); /* True when we're supposed to set the basic block mark whenever a label is seen. Unless the target is doing Something Weird, just call dwarf2_emit_label. */ -bfd_boolean dwarf2_loc_mark_labels; +extern bfd_boolean dwarf2_loc_mark_labels; extern void dwarf2_finish (void); From owner-svn-src-stable-11@freebsd.org Fri Apr 10 00:23:35 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 910702AB80F; Fri, 10 Apr 2020 00:23:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzJR3Hypz4V0x; Fri, 10 Apr 2020 00:23:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C4FF1D70B; Fri, 10 Apr 2020 00:23:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0NZ6n012385; Fri, 10 Apr 2020 00:23:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0NYHG012382; Fri, 10 Apr 2020 00:23:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100023.03A0NYHG012382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:23:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359761 - in stable: 11/stand/mips/beri/loader 11/stand/powerpc/ofw 11/stand/uboot/lib 12/stand/mips/beri/loader 12/stand/powerpc/ofw 12/stand/uboot/lib X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/mips/beri/loader 11/stand/powerpc/ofw 11/stand/uboot/lib 12/stand/mips/beri/loader 12/stand/powerpc/ofw 12/stand/uboot/lib X-SVN-Commit-Revision: 359761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:23:35 -0000 Author: kevans Date: Fri Apr 10 00:23:34 2020 New Revision: 359761 URL: https://svnweb.freebsd.org/changeset/base/359761 Log: MFC r359688: stand: -fno-common fixes for !x86 loaders - beriloader: archsw is declared extern and defined elsewhere - ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and ppc64_elf_freebsd.c respectively - ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is building -fno-common will become the default in GCC10/LLVM11. Modified: stable/11/stand/mips/beri/loader/main.c stable/11/stand/powerpc/ofw/conf.c stable/11/stand/uboot/lib/glue.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/mips/beri/loader/main.c stable/12/stand/powerpc/ofw/conf.c stable/12/stand/uboot/lib/glue.h Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/mips/beri/loader/main.c ============================================================================== --- stable/11/stand/mips/beri/loader/main.c Thu Apr 9 23:51:18 2020 (r359760) +++ stable/11/stand/mips/beri/loader/main.c Fri Apr 10 00:23:34 2020 (r359761) @@ -59,8 +59,6 @@ struct devsw *devsw[] = { NULL }; -struct arch_switch archsw; - struct file_format *file_formats[] = { &beri_elf, NULL Modified: stable/11/stand/powerpc/ofw/conf.c ============================================================================== --- stable/11/stand/powerpc/ofw/conf.c Thu Apr 9 23:51:18 2020 (r359760) +++ stable/11/stand/powerpc/ofw/conf.c Fri Apr 10 00:23:34 2020 (r359761) @@ -97,8 +97,8 @@ struct netif_driver *netif_drivers[] = { * rather than reading the file go first. */ -struct file_format ofw_elf; -struct file_format ofw_elf64; +extern struct file_format ofw_elf; +extern struct file_format ofw_elf64; struct file_format *file_formats[] = { &ofw_elf, Modified: stable/11/stand/uboot/lib/glue.h ============================================================================== --- stable/11/stand/uboot/lib/glue.h Thu Apr 9 23:51:18 2020 (r359760) +++ stable/11/stand/uboot/lib/glue.h Fri Apr 10 00:23:34 2020 (r359761) @@ -56,7 +56,7 @@ #endif int syscall(int, int *, ...); -void *syscall_ptr; +extern void *syscall_ptr; int api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig); int api_search_sig(struct api_signature **sig); From owner-svn-src-stable-11@freebsd.org Fri Apr 10 00:25:15 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD4622AB92E; Fri, 10 Apr 2020 00:25:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzLM45Fcz4VFx; Fri, 10 Apr 2020 00:25:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8738A1D710; Fri, 10 Apr 2020 00:25:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0PF6T012583; Fri, 10 Apr 2020 00:25:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0PFLG012582; Fri, 10 Apr 2020 00:25:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100025.03A0PFLG012582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359762 - in stable: 11/usr.sbin/config 12/usr.sbin/config X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.sbin/config 12/usr.sbin/config X-SVN-Commit-Revision: 359762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:25:15 -0000 Author: kevans Date: Fri Apr 10 00:25:14 2020 New Revision: 359762 URL: https://svnweb.freebsd.org/changeset/base/359762 Log: MFC r359689: config(8): "fix" a couple of buffer overflows Recently added/changed lines in various kernel configs have caused some buffer overflows that went undetected. These were detected with a config built using -fno-common as these line buffers smashed one of our arrays, then further triaged with ASAN. Double the sizes; this is really not a great fix, but addresses the immediate need until someone rewrites config. While here, add some bounds checking so that we don't need to detect this by random bus errors or other weird failures. Modified: stable/11/usr.sbin/config/main.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/config/main.c Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.sbin/config/main.c ============================================================================== --- stable/11/usr.sbin/config/main.c Fri Apr 10 00:23:34 2020 (r359761) +++ stable/11/usr.sbin/config/main.c Fri Apr 10 00:25:14 2020 (r359762) @@ -311,7 +311,7 @@ usage(void) char * get_word(FILE *fp) { - static char line[80]; + static char line[160]; int ch; char *cp; int escaped_nl = 0; @@ -341,11 +341,17 @@ begin: *cp = 0; return (line); } - while ((ch = getc(fp)) != EOF) { + while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) { if (isspace(ch)) break; *cp++ = ch; } + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + fprintf(stderr, "config: attempted overflow, partial line: `%s'", + line); + exit(2); + } *cp = 0; if (ch == EOF) return ((char *)EOF); @@ -361,7 +367,7 @@ begin: char * get_quoted_word(FILE *fp) { - static char line[256]; + static char line[512]; int ch; char *cp; int escaped_nl = 0; @@ -404,15 +410,29 @@ begin: } if (ch != quote && escaped_nl) *cp++ = '\\'; + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + printf( + "config: line buffer overflow reading partial line `%s'\n", + line); + exit(2); + } *cp++ = ch; escaped_nl = 0; } } else { *cp++ = ch; - while ((ch = getc(fp)) != EOF) { + while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) { if (isspace(ch)) break; *cp++ = ch; + } + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + printf( + "config: line buffer overflow reading partial line `%s'\n", + line); + exit(2); } if (ch != EOF) (void) ungetc(ch, fp); From owner-svn-src-stable-11@freebsd.org Fri Apr 10 00:27:21 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AD342ABA43; Fri, 10 Apr 2020 00:27:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzNn17Zxz4VWd; Fri, 10 Apr 2020 00:27:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07D951D716; Fri, 10 Apr 2020 00:27:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0RK7F012785; Fri, 10 Apr 2020 00:27:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0RJLU012779; Fri, 10 Apr 2020 00:27:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100027.03A0RJLU012779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359763 - in stable: 11/usr.bin/gprof 11/usr.bin/mail 11/usr.bin/tip/tip 12/usr.bin/gprof 12/usr.bin/mail 12/usr.bin/tip/tip X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/gprof 11/usr.bin/mail 11/usr.bin/tip/tip 12/usr.bin/gprof 12/usr.bin/mail 12/usr.bin/tip/tip X-SVN-Commit-Revision: 359763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:27:21 -0000 Author: kevans Date: Fri Apr 10 00:27:19 2020 New Revision: 359763 URL: https://svnweb.freebsd.org/changeset/base/359763 Log: MFC r359680: mail/gprof/tip: tap with the ugly stick The ugly stick here is this bit in the respective headers: #ifndef EXTERN #define EXTERN extern #endif with a follow-up #define EXTERN in a single .c file to push all of their definitions into one spot. A pass should be made over these three later to push these definitions into the correct files instead, but this will suffice for now and at a more leisurely pace. Modified: stable/11/usr.bin/gprof/gprof.c stable/11/usr.bin/gprof/gprof.h stable/11/usr.bin/mail/glob.h stable/11/usr.bin/mail/main.c stable/11/usr.bin/mail/strings.c stable/11/usr.bin/tip/tip/tip.c stable/11/usr.bin/tip/tip/tip.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.bin/gprof/gprof.c stable/12/usr.bin/gprof/gprof.h stable/12/usr.bin/mail/glob.h stable/12/usr.bin/mail/main.c stable/12/usr.bin/mail/strings.c stable/12/usr.bin/tip/tip/tip.c stable/12/usr.bin/tip/tip/tip.h Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.bin/gprof/gprof.c ============================================================================== --- stable/11/usr.bin/gprof/gprof.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/gprof/gprof.c Fri Apr 10 00:27:19 2020 (r359763) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#define EXTERN #include "gprof.h" static int valcmp(const void *, const void *); Modified: stable/11/usr.bin/gprof/gprof.h ============================================================================== --- stable/11/usr.bin/gprof/gprof.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/gprof/gprof.h Fri Apr 10 00:27:19 2020 (r359763) @@ -70,18 +70,22 @@ typedef int bool; */ #define HISTORICAL_SCALE_2 2 +#ifndef EXTERN +#define EXTERN extern +#endif + /* * ticks per second */ -long hz; +EXTERN long hz; -size_t histcounter_size; -int histcounter_type; +EXTERN size_t histcounter_size; +EXTERN int histcounter_type; -char *a_outname; +EXTERN char *a_outname; #define A_OUTNAME "a.out" -char *gmonname; +EXTERN char *gmonname; #define GMONSUM "gmon.sum" /* @@ -141,9 +145,9 @@ struct nl { }; typedef struct nl nltype; -nltype *nl; /* the whole namelist */ -nltype *npe; /* the virtual end of the namelist */ -int nname; /* the number of function names */ +EXTERN nltype *nl; /* the whole namelist */ +EXTERN nltype *npe; /* the virtual end of the namelist */ +EXTERN int nname; /* the number of function names */ #define HASCYCLEXIT 0x08 /* node has arc exiting from cycle */ #define CYCLEHEAD 0x10 /* node marked as head of a cycle */ @@ -162,9 +166,9 @@ struct cl { }; typedef struct cl cltype; -arctype *archead; /* the head of arcs in current cycle list */ -cltype *cyclehead; /* the head of the list */ -int cyclecnt; /* the number of cycles found */ +EXTERN arctype *archead; /* the head of arcs in current cycle list */ +EXTERN cltype *cyclehead; /* the head of the list */ +EXTERN int cyclecnt; /* the number of cycles found */ #define CYCLEMAX 100 /* maximum cycles before cutting one of them */ /* @@ -178,8 +182,8 @@ int cyclecnt; /* the number of cycles found */ * namelist entries for cycle headers. * the number of discovered cycles. */ -nltype *cyclenl; /* cycle header namelist */ -int ncycle; /* number of cycles discovered */ +EXTERN nltype *cyclenl; /* cycle header namelist */ +EXTERN int ncycle; /* number of cycles discovered */ /* * The header on the gmon.out file. @@ -195,43 +199,46 @@ struct ophdr { int ncnt; }; -int debug; +EXTERN int debug; /* * Each discretized pc sample has * a count of the number of samples in its range */ -double *samples; +EXTERN double *samples; -unsigned long s_lowpc; /* lowpc from the profile file */ -unsigned long s_highpc; /* highpc from the profile file */ -unsigned long lowpc, highpc; /* range profiled, in historical units */ -unsigned sampbytes; /* number of bytes of samples */ -int nsamples; /* number of samples */ -double actime; /* accumulated time thus far for putprofline */ -double totime; /* total time for all routines */ -double printtime; /* total of time being printed */ -double scale; /* scale factor converting samples to pc +EXTERN unsigned long s_lowpc; /* lowpc from the profile file */ +EXTERN unsigned long s_highpc; /* highpc from the profile file */ +/* range profiled, in historical units */ +EXTERN unsigned long lowpc, highpc; +EXTERN unsigned sampbytes; /* number of bytes of samples */ +EXTERN int nsamples; /* number of samples */ +/* accumulated time thus far for putprofline */ +EXTERN double actime; +EXTERN double totime; /* total time for all routines */ +EXTERN double printtime; /* total of time being printed */ +EXTERN double scale; /* scale factor converting samples to pc values: each sample covers scale bytes */ -unsigned char *textspace; /* text space of a.out in core */ -int cyclethreshold; /* with -C, minimum cycle size to ignore */ +EXTERN unsigned char *textspace; /* text space of a.out in core */ +/* with -C, minimum cycle size to ignore */ +EXTERN int cyclethreshold; /* * option flags, from a to z. */ -bool aflag; /* suppress static functions */ -bool bflag; /* blurbs, too */ -bool Cflag; /* find cut-set to eliminate cycles */ -bool dflag; /* debugging options */ -bool eflag; /* specific functions excluded */ -bool Eflag; /* functions excluded with time */ -bool fflag; /* specific functions requested */ -bool Fflag; /* functions requested with time */ -bool kflag; /* arcs to be deleted */ -bool Kflag; /* use the running kernel for symbols */ -bool sflag; /* sum multiple gmon.out files */ -bool uflag; /* suppress symbols hidden from C */ -bool zflag; /* zero time/called functions, too */ +EXTERN bool aflag; /* suppress static functions */ +EXTERN bool bflag; /* blurbs, too */ +EXTERN bool Cflag; /* find cut-set to eliminate cycles */ +EXTERN bool dflag; /* debugging options */ +EXTERN bool eflag; /* specific functions excluded */ +EXTERN bool Eflag; /* functions excluded with time */ +EXTERN bool fflag; /* specific functions requested */ +EXTERN bool Fflag; /* functions requested with time */ +EXTERN bool kflag; /* arcs to be deleted */ +EXTERN bool Kflag; /* use the running kernel for symbols */ +EXTERN bool sflag; /* sum multiple gmon.out files */ +EXTERN bool uflag; /* suppress symbols hidden from C */ +EXTERN bool zflag; /* zero time/called functions, too */ /* * structure for various string lists @@ -240,12 +247,12 @@ struct stringlist { struct stringlist *next; char *string; }; -struct stringlist *elist; -struct stringlist *Elist; -struct stringlist *flist; -struct stringlist *Flist; -struct stringlist *kfromlist; -struct stringlist *ktolist; +extern struct stringlist *elist; +extern struct stringlist *Elist; +extern struct stringlist *flist; +extern struct stringlist *Flist; +extern struct stringlist *kfromlist; +extern struct stringlist *ktolist; /* * function declarations Modified: stable/11/usr.bin/mail/glob.h ============================================================================== --- stable/11/usr.bin/mail/glob.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/mail/glob.h Fri Apr 10 00:27:19 2020 (r359763) @@ -36,51 +36,51 @@ * def.h must be included first. */ -int msgCount; /* Count of messages read in */ -int rcvmode; /* True if receiving mail */ -int sawcom; /* Set after first command */ -char *Tflag; /* -T temp file for netnews */ -int senderr; /* An error while checking */ -int edit; /* Indicates editing a file */ -int readonly; /* Will be unable to rewrite file */ -int noreset; /* String resets suspended */ -int sourcing; /* Currently reading variant file */ -int loading; /* Loading user definitions */ -int cond; /* Current state of conditional exc. */ -FILE *itf; /* Input temp file buffer */ -FILE *otf; /* Output temp file buffer */ -int image; /* File descriptor for image of msg */ -FILE *input; /* Current command input file */ -char mailname[PATHSIZE]; /* Name of current file */ -char prevfile[PATHSIZE]; /* Name of previous file */ -char *homedir; /* Path name of home directory */ -char *myname; /* My login name */ -off_t mailsize; /* Size of system mailbox */ -int lexnumber; /* Number of TNUMBER from scan() */ -char lexstring[STRINGLEN]; /* String from TSTRING, scan() */ -int regretp; /* Pointer to TOS of regret tokens */ -int regretstack[REGDEP]; /* Stack of regretted tokens */ -char *string_stack[REGDEP]; /* Stack of regretted strings */ -int numberstack[REGDEP]; /* Stack of regretted numbers */ -struct message *dot; /* Pointer to current message */ -struct message *message; /* The actual message structure */ -struct var *variables[HSHSIZE]; /* Pointer to active var list */ -struct grouphead *groups[HSHSIZE];/* Pointer to active groups */ -struct ignoretab ignore[2]; /* ignored and retained fields +extern int msgCount; /* Count of messages read in */ +extern int rcvmode; /* True if receiving mail */ +extern int sawcom; /* Set after first command */ +extern char *Tflag; /* -T temp file for netnews */ +extern int senderr; /* An error while checking */ +extern int edit; /* Indicates editing a file */ +extern int readonly; /* Will be unable to rewrite file */ +extern int noreset; /* String resets suspended */ +extern int sourcing; /* Currently reading variant file */ +extern int loading; /* Loading user definitions */ +extern int cond; /* Current state of conditional exc. */ +extern FILE *itf; /* Input temp file buffer */ +extern FILE *otf; /* Output temp file buffer */ +extern int image; /* File descriptor for image of msg */ +extern FILE *input; /* Current command input file */ +extern char mailname[PATHSIZE]; /* Name of current file */ +extern char prevfile[PATHSIZE]; /* Name of previous file */ +extern char *homedir; /* Path name of home directory */ +extern char *myname; /* My login name */ +extern off_t mailsize; /* Size of system mailbox */ +extern int lexnumber; /* Number of TNUMBER from scan() */ +extern char lexstring[STRINGLEN]; /* String from TSTRING, scan() */ +extern int regretp; /* Pointer to TOS of regret tokens */ +extern int regretstack[REGDEP]; /* Stack of regretted tokens */ +extern char *string_stack[REGDEP]; /* Stack of regretted strings */ +extern int numberstack[REGDEP]; /* Stack of regretted numbers */ +extern struct message *dot; /* Pointer to current message */ +extern struct message *message; /* The actual message structure */ +extern struct var *variables[HSHSIZE]; /* Pointer to active var list */ +extern struct grouphead *groups[HSHSIZE];/* Pointer to active groups */ +extern struct ignoretab ignore[2]; /* ignored and retained fields 0 is ignore, 1 is retain */ -struct ignoretab saveignore[2]; /* ignored and retained fields +extern struct ignoretab saveignore[2]; /* ignored and retained fields on save to folder */ -struct ignoretab ignoreall[2]; /* special, ignore all headers */ -char **altnames; /* List of alternate names for user */ -int debug; /* Debug flag set */ -int screenwidth; /* Screen width, or best guess */ -int screenheight; /* Screen height, or best guess, +extern struct ignoretab ignoreall[2]; /* special, ignore all headers */ +extern char **altnames; /* List of alternate names for user */ +extern int debug; /* Debug flag set */ +extern int screenwidth; /* Screen width, or best guess */ +extern int screenheight; /* Screen height, or best guess, for "header" command */ -int realscreenheight; /* the real screen height */ +extern int realscreenheight; /* the real screen height */ #include -jmp_buf srbuf; +extern jmp_buf srbuf; /* @@ -91,7 +91,7 @@ jmp_buf srbuf; */ #define NSPACE 25 /* Total number of string spaces */ -struct strings { +extern struct strings { char *s_topFree; /* Beginning of this area */ char *s_nextFree; /* Next alloctable place here */ unsigned s_nleft; /* Number of bytes left here */ Modified: stable/11/usr.bin/mail/main.c ============================================================================== --- stable/11/usr.bin/mail/main.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/mail/main.c Fri Apr 10 00:27:19 2020 (r359763) @@ -50,6 +50,49 @@ __FBSDID("$FreeBSD$"); * * Startup -- interface with user. */ +int msgCount; +int rcvmode; +int sawcom; +char *Tflag; +int senderr; +int edit; +int readonly; +int noreset; +int sourcing; +int loading; +int cond; +FILE *itf; +FILE *otf; +int image; +FILE *input; +char mailname[PATHSIZE]; +char prevfile[PATHSIZE]; +char *homedir; +char *myname; +off_t mailsize; +int lexnumber; +char lexstring[STRINGLEN]; +int regretp; +int regretstack[REGDEP]; +char *string_stack[REGDEP]; +int numberstack[REGDEP]; +struct message *dot; +struct message *message; +struct var *variables[HSHSIZE]; +struct grouphead *groups[HSHSIZE]; +struct ignoretab ignore[2]; + +struct ignoretab saveignore[2]; + +struct ignoretab ignoreall[2]; +char **altnames; +int debug; +int screenwidth; +int screenheight; + +int realscreenheight; + +jmp_buf srbuf; static jmp_buf hdrjmp; Modified: stable/11/usr.bin/mail/strings.c ============================================================================== --- stable/11/usr.bin/mail/strings.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/mail/strings.c Fri Apr 10 00:27:19 2020 (r359763) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include "rcv.h" #include "extern.h" +struct strings stringdope[NSPACE]; + /* * Allocate size more bytes of space and return the address of the * first byte to the caller. An even number of bytes are always Modified: stable/11/usr.bin/tip/tip/tip.c ============================================================================== --- stable/11/usr.bin/tip/tip/tip.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/tip/tip/tip.c Fri Apr 10 00:27:19 2020 (r359763) @@ -52,6 +52,7 @@ static const char rcsid[] = "$OpenBSD: tip.c,v 1.30 20 * or * cu phone-number [-s speed] [-l line] [-a acu] */ +#define EXTERN #include "tip.h" #include "pathnames.h" Modified: stable/11/usr.bin/tip/tip/tip.h ============================================================================== --- stable/11/usr.bin/tip/tip/tip.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/11/usr.bin/tip/tip/tip.h Fri Apr 10 00:27:19 2020 (r359763) @@ -56,40 +56,44 @@ #include #include +#ifndef EXTERN +#define EXTERN extern +#endif + /* * Remote host attributes */ -char *DV; /* UNIX device(s) to open */ -char *EL; /* chars marking an EOL */ -char *CM; /* initial connection message */ -char *IE; /* EOT to expect on input */ -char *OE; /* EOT to send to complete FT */ -char *CU; /* call unit if making a phone call */ -char *AT; /* acu type */ -char *PN; /* phone number(s) */ -char *DI; /* disconnect string */ -char *PA; /* parity to be generated */ +EXTERN char *DV; /* UNIX device(s) to open */ +EXTERN char *EL; /* chars marking an EOL */ +EXTERN char *CM; /* initial connection message */ +EXTERN char *IE; /* EOT to expect on input */ +EXTERN char *OE; /* EOT to send to complete FT */ +EXTERN char *CU; /* call unit if making a phone call */ +EXTERN char *AT; /* acu type */ +EXTERN char *PN; /* phone number(s) */ +EXTERN char *DI; /* disconnect string */ +EXTERN char *PA; /* parity to be generated */ -char *PH; /* phone number file */ -char *RM; /* remote file name */ -char *HO; /* host name */ +EXTERN char *PH; /* phone number file */ +EXTERN char *RM; /* remote file name */ +EXTERN char *HO; /* host name */ -long BR; /* line speed for conversation */ -long FS; /* frame size for transfers */ +EXTERN long BR; /* line speed for conversation */ +EXTERN long FS; /* frame size for transfers */ -short DU; /* this host is dialed up */ -short HW; /* this device is hardwired, see hunt.c */ -char *ES; /* escape character */ -char *EX; /* exceptions */ -char *FO; /* force (literal next) char*/ -char *RC; /* raise character */ -char *RE; /* script record file */ -char *PR; /* remote prompt */ -long DL; /* line delay for file transfers to remote */ -long CL; /* char delay for file transfers to remote */ -long ET; /* echocheck timeout */ -long LD; /* line disc */ -short HD; /* this host is half duplex - do local echo */ +EXTERN short DU; /* this host is dialed up */ +EXTERN short HW; /* this device is hardwired, see hunt.c */ +EXTERN char *ES; /* escape character */ +EXTERN char *EX; /* exceptions */ +EXTERN char *FO; /* force (literal next) char*/ +EXTERN char *RC; /* raise character */ +EXTERN char *RE; /* script record file */ +EXTERN char *PR; /* remote prompt */ +EXTERN long DL; /* line delay for file transfers to remote */ +EXTERN long CL; /* char delay for file transfers to remote */ +EXTERN long ET; /* echocheck timeout */ +EXTERN long LD; /* line disc */ +EXTERN short HD; /* this host is half duplex - do local echo */ /* * String value table @@ -235,39 +239,39 @@ extern value_t vtable[]; /* variable table */ #define NOFILE ((FILE *)NULL) #define NOPWD ((struct passwd *)0) -struct termios term; /* current mode of terminal */ -struct termios defterm; /* initial mode of terminal */ -struct termios defchars; /* current mode with initial chars */ -int gotdefterm; +EXTERN struct termios term; /* current mode of terminal */ +EXTERN struct termios defterm; /* initial mode of terminal */ +EXTERN struct termios defchars; /* current mode with initial chars */ +EXTERN int gotdefterm; -FILE *fscript; /* FILE for scripting */ +EXTERN FILE *fscript; /* FILE for scripting */ -int fildes[2]; /* file transfer synchronization channel */ -int repdes[2]; /* read process sychronization channel */ -int FD; /* open file descriptor to remote host */ -int AC; /* open file descriptor to dialer (v831 only) */ -int vflag; /* print .tiprc initialization sequence */ -int noesc; /* no `~' escape char */ -int sfd; /* for ~< operation */ -pid_t tipin_pid; /* pid of tipin */ -pid_t tipout_pid; /* pid of tipout */ -uid_t uid, euid; /* real and effective user id's */ -gid_t gid, egid; /* real and effective group id's */ -int stop; /* stop transfer session flag */ -int quit; /* same; but on other end */ -int intflag; /* recognized interrupt */ -int stoprompt; /* for interrupting a prompt session */ -int timedout; /* ~> transfer timedout */ -int cumode; /* simulating the "cu" program */ -int bits8; /* terminal is 8-bit mode */ +EXTERN int fildes[2]; /* file transfer synchronization channel */ +EXTERN int repdes[2]; /* read process sychronization channel */ +EXTERN int FD; /* open file descriptor to remote host */ +EXTERN int AC; /* open file descriptor to dialer (v831 only) */ +EXTERN int vflag; /* print .tiprc initialization sequence */ +EXTERN int noesc; /* no `~' escape char */ +EXTERN int sfd; /* for ~< operation */ +EXTERN pid_t tipin_pid; /* pid of tipin */ +EXTERN pid_t tipout_pid; /* pid of tipout */ +EXTERN uid_t uid, euid; /* real and effective user id's */ +EXTERN gid_t gid, egid; /* real and effective group id's */ +EXTERN int stop; /* stop transfer session flag */ +EXTERN int quit; /* same; but on other end */ +EXTERN int intflag; /* recognized interrupt */ +EXTERN int stoprompt; /* for interrupting a prompt session */ +EXTERN int timedout; /* ~> transfer timedout */ +EXTERN int cumode; /* simulating the "cu" program */ +EXTERN int bits8; /* terminal is 8-bit mode */ #define STRIP_PAR (bits8 ? 0377 : 0177) -char fname[PATH_MAX]; /* file name buffer for ~< */ -char copyname[PATH_MAX]; /* file name buffer for ~> */ -char ccc; /* synchronization character */ -char *uucplock; /* name of lock file for uucp's */ +EXTERN char fname[PATH_MAX]; /* file name buffer for ~< */ +EXTERN char copyname[PATH_MAX]; /* file name buffer for ~> */ +EXTERN char ccc; /* synchronization character */ +EXTERN char *uucplock; /* name of lock file for uucp's */ -int odisc; /* initial tty line discipline */ +EXTERN int odisc; /* initial tty line discipline */ extern int disc; /* current tty discpline */ extern char *__progname; /* program name */ From owner-svn-src-stable-11@freebsd.org Fri Apr 10 22:18:31 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E10AA27B899; Fri, 10 Apr 2020 22:18:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zXTg5jbQz4dYj; Fri, 10 Apr 2020 22:18:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF56B5843; Fri, 10 Apr 2020 22:18:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03AMIVeX018490; Fri, 10 Apr 2020 22:18:31 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03AMIUeA018486; Fri, 10 Apr 2020 22:18:30 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202004102218.03AMIUeA018486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 10 Apr 2020 22:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359783 - in stable/11/usr.bin/calendar: . calendars tests X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/usr.bin/calendar: . calendars tests X-SVN-Commit-Revision: 359783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 22:18:31 -0000 Author: gonzo Date: Fri Apr 10 22:18:30 2020 New Revision: 359783 URL: https://svnweb.freebsd.org/changeset/base/359783 Log: MFC r359585, r359587 r359585: Fix calculation of the recurring weekdays Both the result of the first_dayofweek_of_year and the target weekday are zero-based (0 fo sunday) while the target month-day or year-day is 1-based. Adjust logic accordingly. Also add testcase for this PR to the kyua test suite PR: 201062 Submitted by: Richard Narron r359587: Remove hardcoded US Election Day from calendar.usholiday calendar(1) syntax is not capable of representing the rules for the US Election Day. The hardcoded date was set in r15066 in 1996 and hasn't changed since then. PR: 173389 Reported by: Steve Ames Added: stable/11/usr.bin/calendar/tests/regress.s5.out - copied unchanged from r359585, head/usr.bin/calendar/tests/regress.s5.out Modified: stable/11/usr.bin/calendar/calendars/calendar.usholiday stable/11/usr.bin/calendar/parsedata.c stable/11/usr.bin/calendar/tests/calendar.calibrate stable/11/usr.bin/calendar/tests/regress.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/calendar/calendars/calendar.usholiday ============================================================================== --- stable/11/usr.bin/calendar/calendars/calendar.usholiday Fri Apr 10 22:18:13 2020 (r359782) +++ stable/11/usr.bin/calendar/calendars/calendar.usholiday Fri Apr 10 22:18:30 2020 (r359783) @@ -30,7 +30,6 @@ 09/22* Autumnal Equinox 10/MonSecond Columbus Day in USA (2nd Monday of October) 10/31 All Hallows Eve (Halloween) -11/05* Election Day in USA (1st Tuesday after 1st Monday for even years) 11/SunFirst Daylight Savings Time ends in USA; clocks move back (1st Sunday of November) 11/11 Veterans' Day 11/ThuFourth Thanksgiving Day (4th Thursday in November) Modified: stable/11/usr.bin/calendar/parsedata.c ============================================================================== --- stable/11/usr.bin/calendar/parsedata.c Fri Apr 10 22:18:13 2020 (r359782) +++ stable/11/usr.bin/calendar/parsedata.c Fri Apr 10 22:18:30 2020 (r359783) @@ -578,7 +578,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int /* Every dayofweek of the year */ if (lflags == (F_DAYOFWEEK | F_VARIABLE)) { dow = first_dayofweek_of_year(year); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; while (d <= 366) { if (remember_yd(year, d, &rm, &rd)) remember(&remindex, @@ -616,7 +618,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { offset = indextooffset(modifierindex); dow = first_dayofweek_of_month(year, imonth); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; if (offset > 0) { while (d <= yearinfo->monthdays[imonth]) { @@ -650,7 +654,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int /* Every dayofweek of the month */ if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; while (d <= yearinfo->monthdays[imonth]) { if (remember_ymd(year, imonth, d)) remember(&remindex, Modified: stable/11/usr.bin/calendar/tests/calendar.calibrate ============================================================================== --- stable/11/usr.bin/calendar/tests/calendar.calibrate Fri Apr 10 22:18:13 2020 (r359782) +++ stable/11/usr.bin/calendar/tests/calendar.calibrate Fri Apr 10 22:18:30 2020 (r359783) @@ -188,6 +188,7 @@ LANG=C 06/28 jun 28 06/29 jun 29 06/30 jun 30 +06/SunThird sunthird 07/01 jul 1 07/02 jul 2 07/03 jul 3 Copied: stable/11/usr.bin/calendar/tests/regress.s5.out (from r359585, head/usr.bin/calendar/tests/regress.s5.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/calendar/tests/regress.s5.out Fri Apr 10 22:18:30 2020 (r359783, copy of r359585, head/usr.bin/calendar/tests/regress.s5.out) @@ -0,0 +1,3 @@ +Jun 21* sunthird +Jun 21 jun 21 +Jun 22 jun 22 Modified: stable/11/usr.bin/calendar/tests/regress.sh ============================================================================== --- stable/11/usr.bin/calendar/tests/regress.sh Fri Apr 10 22:18:13 2020 (r359782) +++ stable/11/usr.bin/calendar/tests/regress.sh Fri Apr 10 22:18:30 2020 (r359783) @@ -7,12 +7,13 @@ CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}" REGRESSION_START($1) -echo 1..28 +echo 1..29 REGRESSION_TEST(`s1',`$CALENDAR -t 29.12.2006') REGRESSION_TEST(`s2',`$CALENDAR -t 30.12.2006') REGRESSION_TEST(`s3',`$CALENDAR -t 31.12.2006') REGRESSION_TEST(`s4',`$CALENDAR -t 01.01.2007') +REGRESSION_TEST(`s5',`$CALENDAR -t 21.06.2015') REGRESSION_TEST(`a1',`$CALENDAR -A 3 -t 28.12.2006') REGRESSION_TEST(`a2',`$CALENDAR -A 3 -t 29.12.2006') From owner-svn-src-stable-11@freebsd.org Sat Apr 11 07:37:10 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDFB62B1CD3; Sat, 11 Apr 2020 07:37:10 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zmtG4fYgz4HJP; Sat, 11 Apr 2020 07:37:10 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AF1BC8CD; Sat, 11 Apr 2020 07:37:10 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B7bAAl068031; Sat, 11 Apr 2020 07:37:10 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B7bA2w068030; Sat, 11 Apr 2020 07:37:10 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <202004110737.03B7bA2w068030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 11 Apr 2020 07:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359798 - stable/11/usr.bin/ruptime X-SVN-Group: stable-11 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/11/usr.bin/ruptime X-SVN-Commit-Revision: 359798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 07:37:10 -0000 Author: nyan Date: Sat Apr 11 07:37:10 2020 New Revision: 359798 URL: https://svnweb.freebsd.org/changeset/base/359798 Log: MFC: r314640 (by bde) > Fix formatting. ruptime output on FreeBSD cluster machines annoyed me > by usually being double-spaced due to auto-wrap at column 80. > > r212771 increased width of the hostname field from 12 to 25. This was > supposed to allow for 80-column output with all 3 load averages taking > 5 characters each, but it actually gave width exactly 80 and thus worse > than useless auto-wrap in that case. 3 wide load average fields are > unusual, but later expansion of another field gave the auto-wrap with > just 2 wide load average fields. > > Change to dynamic field widths for all fields except the uptime. This > also fixes the formatting of high (above 9999) user counts and not > very high (above 9.99) load averages. The formatting for numbers now > breaks at 99999.99, but scientific notation should be used starting > well below that. > > The field width for the uptime remains hard-coded to work consistently > for uptimes less than 10000 days, but this gives too much space for > small uptimes. Punctuation between fields could be improved in many > ways, for example by removing it. Modified: stable/11/usr.bin/ruptime/ruptime.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ruptime/ruptime.c ============================================================================== --- stable/11/usr.bin/ruptime/ruptime.c Sat Apr 11 07:37:08 2020 (r359797) +++ stable/11/usr.bin/ruptime/ruptime.c Sat Apr 11 07:37:10 2020 (r359798) @@ -69,6 +69,7 @@ static DIR *dirp; static int hscmp(const void *, const void *); static char *interval(time_t, const char *); +static int iwidth(int); static int lcmp(const void *, const void *); static void ruptime(const char *, int, int (*)(const void *, const void *)); static int tcmp(const void *, const void *); @@ -143,6 +144,21 @@ interval(time_t tval, const char *updown) return (resbuf); } +/* Width to print a small nonnegative integer. */ +static int +iwidth(int w) +{ + if (w < 10) + return (1); + if (w < 100) + return (2); + if (w < 1000) + return (3); + if (w < 10000) + return (4); + return (5); +} + #define HS(a) ((const struct hs *)(a)) /* Alphabetical comparison. */ @@ -176,14 +192,17 @@ ruptime(const char *host, int aflg, int (*cmp)(const v struct whod *wd; struct whoent *we; struct dirent *dp; - const char *hostname; - int fd, i, maxloadav; + int fd, hostnamewidth, i, loadavwidth[3], userswidth, w; size_t hspace; ssize_t cc; rewinddir(dirp); hsp = NULL; - maxloadav = -1; + hostnamewidth = 0; + loadavwidth[0] = 4; + loadavwidth[1] = 4; + loadavwidth[2] = 4; + userswidth = 1; (void)time(&now); for (nhosts = hspace = 0; (dp = readdir(dirp)) != NULL;) { if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5) != 0) @@ -206,22 +225,25 @@ ruptime(const char *host, int aflg, int (*cmp)(const v if (cc < (ssize_t)WHDRSIZE) continue; - if (host != NULL) { - hostname = wd->wd_hostname; - if (strcasecmp(hostname, host) != 0) - continue; - } + if (host != NULL && strcasecmp(wd->wd_hostname, host) != 0) + continue; if (LEFTEARTH(wd->wd_recvtime)) continue; - for (i = 0; i < 2; i++) - if (wd->wd_loadav[i] > maxloadav) - maxloadav = wd->wd_loadav[i]; + if (hostnamewidth < (int)strlen(wd->wd_hostname)) + hostnamewidth = (int)strlen(wd->wd_hostname); + for (i = 0; i < 3; i++) { + w = iwidth(wd->wd_loadav[i] / 100) + 3; + if (loadavwidth[i] < w) + loadavwidth[i] = w; + } for (hsp->hs_nusers = 0, we = &wd->wd_we[0]; (char *)(we + 1) <= (char *)wd + cc; we++) if (aflg || we->we_idle < 3600) ++hsp->hs_nusers; + if (userswidth < iwidth(hsp->hs_nusers)) + userswidth = iwidth(hsp->hs_nusers); ++hsp; ++nhosts; } @@ -233,27 +255,28 @@ ruptime(const char *host, int aflg, int (*cmp)(const v } qsort(hs, nhosts, sizeof(hs[0]), cmp); + w = userswidth + loadavwidth[0] + loadavwidth[1] + loadavwidth[2]; + if (hostnamewidth + w > 41) + hostnamewidth = 41 - w; /* limit to 79 cols */ for (i = 0; i < (int)nhosts; i++) { hsp = &hs[i]; wd = &hsp->hs_wd; if (ISDOWN(hsp)) { - (void)printf("%-25.25s%s\n", wd->wd_hostname, + (void)printf("%-*.*s%s\n", + hostnamewidth, hostnamewidth, wd->wd_hostname, interval(now - hsp->hs_wd.wd_recvtime, "down")); continue; } (void)printf( - "%-25.25s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n", - wd->wd_hostname, + "%-*.*s %s, %*d user%s load %*.2f, %*.2f, %*.2f\n", + hostnamewidth, hostnamewidth, wd->wd_hostname, interval((time_t)wd->wd_sendtime - (time_t)wd->wd_boottime, " up"), - hsp->hs_nusers, + userswidth, hsp->hs_nusers, hsp->hs_nusers == 1 ? ", " : "s,", - maxloadav >= 1000 ? 5 : 4, - wd->wd_loadav[0] / 100.0, - maxloadav >= 1000 ? 5 : 4, - wd->wd_loadav[1] / 100.0, - maxloadav >= 1000 ? 5 : 4, - wd->wd_loadav[2] / 100.0); + loadavwidth[0], wd->wd_loadav[0] / 100.0, + loadavwidth[1], wd->wd_loadav[1] / 100.0, + loadavwidth[2], wd->wd_loadav[2] / 100.0); } free(hs); hs = NULL; From owner-svn-src-stable-11@freebsd.org Sat Apr 11 07:46:39 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A64E62B1FFE; Sat, 11 Apr 2020 07:46:39 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zn5C3yssz4Hw9; Sat, 11 Apr 2020 07:46:39 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F089CAC8; Sat, 11 Apr 2020 07:46:39 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B7kdPG074541; Sat, 11 Apr 2020 07:46:39 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B7kdq7074540; Sat, 11 Apr 2020 07:46:39 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <202004110746.03B7kdq7074540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 11 Apr 2020 07:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359799 - stable/11/usr.bin/ruptime X-SVN-Group: stable-11 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/11/usr.bin/ruptime X-SVN-Commit-Revision: 359799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 07:46:39 -0000 Author: nyan Date: Sat Apr 11 07:46:38 2020 New Revision: 359799 URL: https://svnweb.freebsd.org/changeset/base/359799 Log: MFC: r342965 > Fix indentation in ruptime command output for hosts in the "down" state. MFC: r359631 > Remove extra spaces for the load average of machines that are down. PR: 234239, 245296 Modified: stable/11/usr.bin/ruptime/ruptime.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ruptime/ruptime.c ============================================================================== --- stable/11/usr.bin/ruptime/ruptime.c Sat Apr 11 07:37:10 2020 (r359798) +++ stable/11/usr.bin/ruptime/ruptime.c Sat Apr 11 07:46:38 2020 (r359799) @@ -232,18 +232,21 @@ ruptime(const char *host, int aflg, int (*cmp)(const v if (hostnamewidth < (int)strlen(wd->wd_hostname)) hostnamewidth = (int)strlen(wd->wd_hostname); - for (i = 0; i < 3; i++) { - w = iwidth(wd->wd_loadav[i] / 100) + 3; - if (loadavwidth[i] < w) - loadavwidth[i] = w; + + if (!ISDOWN(hsp)) { + for (i = 0; i < 3; i++) { + w = iwidth(wd->wd_loadav[i] / 100) + 3; + if (loadavwidth[i] < w) + loadavwidth[i] = w; + } + for (hsp->hs_nusers = 0, we = &wd->wd_we[0]; + (char *)(we + 1) <= (char *)wd + cc; we++) + if (aflg || we->we_idle < 3600) + ++hsp->hs_nusers; + if (userswidth < iwidth(hsp->hs_nusers)) + userswidth = iwidth(hsp->hs_nusers); } - for (hsp->hs_nusers = 0, we = &wd->wd_we[0]; - (char *)(we + 1) <= (char *)wd + cc; we++) - if (aflg || we->we_idle < 3600) - ++hsp->hs_nusers; - if (userswidth < iwidth(hsp->hs_nusers)) - userswidth = iwidth(hsp->hs_nusers); ++hsp; ++nhosts; } @@ -262,7 +265,7 @@ ruptime(const char *host, int aflg, int (*cmp)(const v hsp = &hs[i]; wd = &hsp->hs_wd; if (ISDOWN(hsp)) { - (void)printf("%-*.*s%s\n", + (void)printf("%-*.*s %s\n", hostnamewidth, hostnamewidth, wd->wd_hostname, interval(now - hsp->hs_wd.wd_recvtime, "down")); continue; From owner-svn-src-stable-11@freebsd.org Sat Apr 11 09:36:42 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50F9F2B4D3C; Sat, 11 Apr 2020 09:36:42 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zqXB17Zpz4PXM; Sat, 11 Apr 2020 09:36:42 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 222DBDF7D; Sat, 11 Apr 2020 09:36:42 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B9agpa041257; Sat, 11 Apr 2020 09:36:42 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B9agdR041256; Sat, 11 Apr 2020 09:36:42 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004110936.03B9agdR041256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 11 Apr 2020 09:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359803 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 359803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 09:36:42 -0000 Author: ae Date: Sat Apr 11 09:36:41 2020 New Revision: 359803 URL: https://svnweb.freebsd.org/changeset/base/359803 Log: MFC r359498: Ignore ND6 neighbor advertisement received for static link-layer entries. Previously such NA could override manually created LLE. Reported by: Martin Beran Modified: stable/11/sys/netinet6/nd6_nbr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/11/sys/netinet6/nd6_nbr.c Sat Apr 11 09:35:48 2020 (r359802) +++ stable/11/sys/netinet6/nd6_nbr.c Sat Apr 11 09:36:41 2020 (r359803) @@ -745,6 +745,12 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + /* + * Do not try to override static entry. + */ + if (ln->la_flags & LLE_STATIC) + goto freeit; + if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { /* * If the link-layer has address, and no lladdr option came,