diff options
Diffstat (limited to 'sbin')
90 files changed, 1823 insertions, 836 deletions
diff --git a/sbin/Makefile.ia64 b/sbin/Makefile.ia64 deleted file mode 100644 index c1e6a41..0000000 --- a/sbin/Makefile.ia64 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SUBDIR += mca diff --git a/sbin/adjkerntz/adjkerntz.8 b/sbin/adjkerntz/adjkerntz.8 index 6f0f15e..1bd1391 100644 --- a/sbin/adjkerntz/adjkerntz.8 +++ b/sbin/adjkerntz/adjkerntz.8 @@ -190,4 +190,4 @@ The utility appeared in .Fx 1.0 . .Sh AUTHORS -.An Andrey A. Chernov Aq ache@astral.msk.su +.An Andrey A. Chernov Aq Mt ache@astral.msk.su diff --git a/sbin/atm/atmconfig/atmconfig.8 b/sbin/atm/atmconfig/atmconfig.8 index 1ff76a1..c8a740c 100644 --- a/sbin/atm/atmconfig/atmconfig.8 +++ b/sbin/atm/atmconfig/atmconfig.8 @@ -316,4 +316,4 @@ List all NATM routes. .Xr natmip 4 , .Xr atm 8 .Sh AUTHORS -.An Hartmut Brandt Aq harti@FreeBSD.org +.An Hartmut Brandt Aq Mt harti@FreeBSD.org diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8 index d31187b..e0f3752 100644 --- a/sbin/bsdlabel/bsdlabel.8 +++ b/sbin/bsdlabel/bsdlabel.8 @@ -109,7 +109,7 @@ argument forces .Nm to use a layout suitable for a different architecture. Current valid values are -.Cm i386 , amd64 , ia64 , +.Cm i386 , amd64 , and .Cm pc98 . If this option is omitted, diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index ce5d375..b99c279 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -165,7 +165,6 @@ main(int argc, char *argv[]) case 'm': if (!strcmp(optarg, "i386") || !strcmp(optarg, "amd64") || - !strcmp(optarg, "ia64") || !strcmp(optarg, "pc98")) { labelsoffset = 1; labeloffset = 0; diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile index 6863375..4f11f19 100644 --- a/sbin/camcontrol/Makefile +++ b/sbin/camcontrol/Makefile @@ -3,7 +3,7 @@ PROG= camcontrol SRCS= camcontrol.c util.c .if !defined(RELEASE_CRUNCH) -SRCS+= fwdownload.c modeedit.c progress.c +SRCS+= fwdownload.c modeedit.c persist.c progress.c .else CFLAGS+= -DMINIMALISTIC .endif diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index 856edc4..0c42564 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 6, 2013 +.Dd November 20, 2013 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -269,6 +269,21 @@ .Op Fl U Ar pwd .Op Fl y .Nm +.Ic persist +.Op device id +.Op generic args +.Aq Fl i Ar action | Fl o Ar action +.Op Fl a +.Op Fl I Ar trans_id +.Op Fl k Ar key +.Op Fl K Ar sa_key +.Op Fl p +.Op Fl R Ar rel_tgt_port +.Op Fl s Ar scope +.Op Fl S +.Op Fl T Ar res_type +.Op Fl U +.Nm .Ic help .Sh DESCRIPTION The @@ -1473,6 +1488,276 @@ to output a line for every firmware segment that is sent to the device by the fwdownload command -- the same as the ones shown in simulation mode. .El +.It Ic persist +Persistent reservation support. +Persistent reservations are a way to reserve a particular +.Tn SCSI +LUN for use by one or more +.Tn SCSI +initiators. +If the +.Fl i +option is specified, +.Nm +will issue the +.Tn SCSI +PERSISTENT RESERVE IN +command using the requested service action. +If the +.Fl o +option is specified, +.Nm +will issue the +.Tn SCSI +PERSISTENT RESERVE OUT +command using the requested service action. +One of those two options is required. +.Pp +Persistent reservations are complex, and fully explaining them is outside +the scope of this manual. +Please visit +http://www.t10.org +and download the latest SPC spec for a full explanation of persistent +reservations. +.Bl -tag -width 8n +.It Fl i Ar mode +Specify the service action for the PERSISTENT RESERVE IN command. +Supported service actions: +.Bl -tag -width 19n +.It read_keys +Report the current persistent reservation generation (PRgeneration) and any +registered keys. +.It read_reservation +Report the persistent reservation, if any. +.It report_capabilities +Report the persistent reservation capabilities of the LUN. +.It read_full_status +Report the full status of persistent reservations on the LUN. +.El +.It Fl o Ar mode +Specify the service action for the PERSISTENT RESERVE OUT command. +For service actions like register that are components of other service +action names, the entire name must be specified. +Otherwise, enough of the service action name must be specified to +distinguish it from other possible service actions. +Supported service actions: +.Bl -tag -width 15n +.It register +Register a reservation key with the LUN or unregister a reservation key. +To register a key, specify the requested key as the Service Action +Reservation Key. +To unregister a key, specify the previously registered key as the +Reservation Key. +To change a key, specify the old key as the Reservation Key and the new +key as the Service Action Reservation Key. +.It register_ignore +This is similar to the register subcommand, except that the Reservation Key +is ignored. +The Service Action Reservation Key will overwrite any previous key +registered for the initiator. +.It reserve +Create a reservation. +A key must be registered with the LUN before the LUN can be reserved, and +it must be specified as the Reservation Key. +The type of reservation must also be specified. +The scope defaults to LUN scope (LU_SCOPE), but may be changed. +.It release +Release a reservation. +The Reservation Key must be specified. +.It clear +Release a reservation and remove all keys from the device. +The Reservation Key must be specified. +.It preempt +Remove a reservation belonging to another initiator. +The Reservation Key must be specified. +The Service Action Reservation Key may be specified, depending on the +operation being performed. +.It preempt_abort +Remove a reservation belonging to another initiator and abort all +outstanding commands from that initiator. +The Reservation Key must be specified. +The Service Action Reservation Key may be specified, depending on the +operation being performed. +.It register_move +Register another initiator with the LUN, and establish a reservation on the +LUN for that initiator. +The Reservation Key and Service Action Reservation Key must be specified. +.It replace_lost +Replace Lost Reservation information. +.El +.It Fl a +Set the All Target Ports (ALL_TG_PT) bit. +This requests that the key registration be applied to all target ports and +not just the particular target port that receives the command. +This only applies to the register and register_ignore actions. +.It Fl I Ar tid +Specify a Transport ID. +This only applies to the Register and Register and Move service actions for +Persistent Reserve Out. +Multiple Transport IDs may be specified with multiple +.Fl I +arguments. +With the Register service action, specifying one or more Transport IDs +implicitly enables the +.Fl S +option which turns on the SPEC_I_PT bit. +Transport IDs generally have the format protocol,id. +.Bl -tag -width 5n +.It SAS +A SAS Transport ID consists of +.Dq sas, +followed by a 64-bit SAS address. +For example: +.Pp +.Dl sas,0x1234567812345678 +.It FC +A Fibre Channel Transport ID consists of +.Dq fcp, +followed by a 64-bit Fibre Channel World Wide Name. +For example: +.Pp +.Dl fcp,0x1234567812345678 +.It SPI +A Parallel SCSI address consists of +.Dq spi, +followed by a SCSI target ID and a relative target port identifier. +For example: +.Pp +.Dl spi,4,1 +.It 1394 +An IEEE 1394 (Firewire) Transport ID consists of +.Dq sbp, +followed by a 64-bit EUI-64 IEEE 1394 node unique identifier. +For example: +.Pp +.Dl sbp,0x1234567812345678 +.It RDMA +A SCSI over RDMA Transport ID consists of +.Dq srp, +followed by a 128-bit RDMA initiator port identifier. +The port identifier must be exactly 32 or 34 (if the leading 0x is +included) hexadecimal digits. +Only hexadecimal (base 16) numbers are supported. +For example: +.Pp +.Dl srp,0x12345678123456781234567812345678 +.It iSCSI +An iSCSI Transport ID consists an iSCSI name and optionally a separator and +iSCSI session ID. +For example, if only the iSCSI name is specified: +.Pp +.Dl iqn.2012-06.com.example:target0 +.Pp +If the iSCSI separator and initiator session ID are specified: +.Pp +.Dl iqn.2012-06.com.example:target0,i,0x123 +.It PCIe +A SCSI over PCIe Transport ID consists of +.Dq sop, +followed by a PCIe Routing ID. +The Routing ID consists of a bus, device and function or in the alternate +form, a bus and function. +The bus must be in the range of 0 to 255 inclusive and the device must be +in the range of 0 to 31 inclusive. +The function must be in the range of 0 to 7 inclusive if the standard form +is used, and in the range of 0 to 255 inclusive if the alternate form is +used. +For example, if a bus, device and function are specified for the standard +Routing ID form: +.Pp +.Dl sop,4,5,1 +.Pp +If the alternate Routing ID form is used: +.Pp +.Dl sop,4,1 +.El +.It Fl k Ar key +Specify the Reservation Key. +This may be in decimal, octal or hexadecimal format. +The value is zero by default if not otherwise specified. +The value must be between 0 and 2^64 - 1, inclusive. +.It Fl K Ar key +Specify the Service Action Reservation Key. +This may be in decimal, octal or hexadecimal format. +The value is zero by default if not otherwise specified. +The value must be between 0 and 2^64 - 1, inclusive. +.It Fl p +Enable the Activate Persist Through Power Loss bit. +This is only used for the register and register_ignore actions. +This requests that the reservation persist across power loss events. +.It Fl s Ar scope +Specify the scope of the reservation. +The scope may be specified by name or by number. +The scope is ignored for register, register_ignore and clear. +If the desired scope isn't available by name, you may specify the number. +.Bl -tag -width 7n +.It lun +LUN scope (0x00). +This encompasses the entire LUN. +.It extent +Extent scope (0x01). +.It element +Element scope (0x02). +.El +.It Fl R Ar rtp +Specify the Relative Target Port. +This only applies to the Register and Move service action of the Persistent +Reserve Out command. +.It Fl S +Enable the SPEC_I_PT bit. +This only applies to the Register service action of Persistent Reserve Out. +You must also specify at least one Transport ID with +.Fl I +if this option is set. +If you specify a Transport ID, this option is automatically set. +It is an error to specify this option for any service action other than +Register. +.It Fl T Ar type +Specify the reservation type. +The reservation type may be specified by name or by number. +If the desired reservation type isn't available by name, you may specify +the number. +Supported reservation type names: +.Bl -tag -width 11n +.It read_shared +Read Shared mode. +.It wr_ex +Write Exclusive mode. +May also be specified as +.Dq write_exclusive . +.It rd_ex +Read Exclusive mode. +May also be specified as +.Dq read_exclusive . +.It ex_ac +Exclusive access mode. +May also be specified as +.Dq exclusive_access . +.It wr_ex_ro +Write Exclusive Registrants Only mode. +May also be specified as +.Dq write_exclusive_reg_only . +.It ex_ac_ro +Exclusive Access Registrants Only mode. +May also be specified as +.Dq exclusive_access_reg_only . +.It wr_ex_ar +Write Exclusive All Registrants mode. +May also be specified as +.Dq write_exclusive_all_regs . +.It ex_ac_ar +Exclusive Access All Registrants mode. +May also be specified as +.Dq exclusive_access_all_regs . +.El +.It Fl U +Specify that the target should unregister the initiator that sent +the Register and Move request. +By default, the target will not unregister the initiator that sends the +Register and Move request. +This option only applies to the Register and Move service action of the +Persistent Reserve Out command. +.El .It Ic help Print out verbose usage information. .El @@ -1639,6 +1924,66 @@ power-on or hardware reset! .Pp .Em DO NOT use this on a device which has an active filesystem! +.Pp +.Bd -literal -offset indent +camcontrol persist da0 -v -i read_keys +.Ed +.Pp +This will read any persistent reservation keys registered with da0, and +display any errors encountered when sending the PERSISTENT RESERVE IN +.Tn SCSI +command. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register -a -K 0x12345678 +.Ed +.Pp +This will register the persistent reservation key 0x12345678 with da0, +apply that registration to all ports on da0, and display any errors that +occur when sending the PERSISTENT RESERVE OUT command. +.Bd -literal -offset indent +camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac +.Ed +.Pp +This will reserve da0 for the exlusive use of the initiator issuing the +command. +The scope of the reservation is the entire LUN. +Any errors sending the PERSISTENT RESERVE OUT command will be displayed. +.Bd -literal -offset indent +camcontrol persist da0 -v -i read_full +.Ed +.Pp +This will display the full status of all reservations on da0 and print out +status if there are any errors. +.Bd -literal -offset indent +camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac +.Ed +.Pp +This will release a reservation on da0 of the type ex_ac +(Exclusive Access). +The Reservation Key for this registration is 0x12345678. +Any errors that occur will be displayed. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register -K 0x12345678 -S \e + -I sas,0x1234567812345678 -I sas,0x8765432187654321 +.Ed +.Pp +This will register the key 0x12345678 with da0, specifying that it applies +to the SAS initiators with SAS addresses 0x1234567812345678 and +0x8765432187654321. +.Bd -literal -offset indent +camcontrol persist da0 -v -o register_move -k 0x87654321 \e + -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678 +.Ed +.Pp +This will move the registration from the current initiator, whose +Registration Key is 0x87654321, to the Fibre Channel initiator with the +Fiber Channel World Wide Node Name 0x1234567812345678. +A new registration key, 0x12345678, will be registered for the initiator +with the Fibre Channel World Wide Node Name 0x1234567812345678, and the +current initiator will be unregistered from the target. +The reservation will be moved to relative target port 2 on the target +device. +The registration will persist across power losses. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , @@ -1666,7 +2011,7 @@ and first appeared in in .Fx 2.0.5 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS The code that parses the generic command line arguments does not know that some of the subcommands take multiple arguments. diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 6783bd3..12a0e5c 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -96,6 +96,7 @@ typedef enum { CAM_CMD_SECURITY = 0x0000001d, CAM_CMD_HPA = 0x0000001e, CAM_CMD_SANITIZE = 0x0000001f, + CAM_CMD_PERSIST = 0x00000020 } cam_cmdmask; typedef enum { @@ -218,6 +219,7 @@ static struct camcontrol_opts option_table[] = { {"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:ys"}, {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, {"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"}, + {"persist", CAM_CMD_PERSIST, CAM_ARG_NONE, "ai:I:k:K:o:ps:ST:U"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -225,12 +227,6 @@ static struct camcontrol_opts option_table[] = { {NULL, 0, 0, NULL} }; -typedef enum { - CC_OR_NOT_FOUND, - CC_OR_AMBIGUOUS, - CC_OR_FOUND -} camcontrol_optret; - struct cam_devitem { struct device_match_result dev_match; int num_periphs; @@ -7826,6 +7822,9 @@ usage(int printlong) " [-U <user|master>] [-y]\n" " camcontrol hpa [dev_id][generic args] [-f] [-l] [-P] [-p pwd]\n" " [-q] [-s max_sectors] [-U pwd] [-y]\n" +" camcontrol persist [dev_id][generic args] <-i action|-o action>\n" +" [-a][-I tid][-k key][-K sa_key][-p][-R rtp]\n" +" [-s scope][-S][-T type][-U]\n" #endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) @@ -7862,8 +7861,9 @@ usage(int printlong) "idle send the ATA IDLE command to the named device\n" "standby send the ATA STANDBY command to the named device\n" "sleep send the ATA SLEEP command to the named device\n" -"fwdownload program firmware of the named device with the given image" +"fwdownload program firmware of the named device with the given image\n" "security report or send ATA security commands to the named device\n" +"persist send the SCSI PERSISTENT RESERVE IN or OUT commands\n" "help this message\n" "Device Identifiers:\n" "bus:target specify the bus and target, lun defaults to 0\n" @@ -7998,6 +7998,22 @@ usage(int printlong) " device\n" "-U pwd unlock the HPA configuration of the device\n" "-y don't ask any questions\n" +"persist arguments:\n" +"-i action specify read_keys, read_reservation, report_cap, or\n" +" read_full_status\n" +"-o action specify register, register_ignore, reserve, release,\n" +" clear, preempt, preempt_abort, register_move, replace_lost\n" +"-a set the All Target Ports (ALL_TG_PT) bit\n" +"-I tid specify a Transport ID, e.g.: sas,0x1234567812345678\n" +"-k key specify the Reservation Key\n" +"-K sa_key specify the Service Action Reservation Key\n" +"-p set the Activate Persist Through Power Loss bit\n" +"-R rtp specify the Relative Target Port\n" +"-s scope specify the scope: lun, extent, element or a number\n" +"-S specify Transport ID for register, requires -I\n" +"-T res_type specify the reservation type: read_shared, wr_ex, rd_ex,\n" +" ex_ac, wr_ex_ro, ex_ac_ro, wr_ex_ar, ex_ac_ar\n" +"-U unregister the current initiator for register_move\n" ); #endif /* MINIMALISTIC */ } @@ -8332,6 +8348,11 @@ main(int argc, char **argv) error = scsisanitize(cam_dev, argc, argv, combinedopt, retry_count, timeout); break; + case CAM_CMD_PERSIST: + error = scsipersist(cam_dev, argc, argv, combinedopt, + retry_count, timeout, arglist & CAM_ARG_VERBOSE, + arglist & CAM_ARG_ERR_RECOVER); + break; #endif /* MINIMALISTIC */ case CAM_CMD_USAGE: usage(1); diff --git a/sbin/camcontrol/camcontrol.h b/sbin/camcontrol/camcontrol.h index 616236a..7c249bf 100644 --- a/sbin/camcontrol/camcontrol.h +++ b/sbin/camcontrol/camcontrol.h @@ -30,6 +30,13 @@ #ifndef _CAMCONTROL_H #define _CAMCONTROL_H + +typedef enum { + CC_OR_NOT_FOUND, + CC_OR_AMBIGUOUS, + CC_OR_FOUND +} camcontrol_optret; + /* * get_hook: Structure for evaluating args in a callback. */ @@ -56,6 +63,9 @@ void mode_list(struct cam_device *device, int page_control, int dbd, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); +int scsipersist(struct cam_device *device, int argc, char **argv, + char *combinedopt, int retry_count, int timeout, int verbose, + int err_recover); char *cget(void *hook, char *name); int iget(void *hook, char *name); void arg_put(void *hook, int letter, void *arg, int count, char *name); diff --git a/sbin/camcontrol/persist.c b/sbin/camcontrol/persist.c new file mode 100644 index 0000000..bcc1073 --- /dev/null +++ b/sbin/camcontrol/persist.c @@ -0,0 +1,966 @@ +/*- + * Copyright (c) 2013 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Ken Merry (Spectra Logic Corporation) + */ +/* + * SCSI Persistent Reservation support for camcontrol(8). + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/ioctl.h> +#include <sys/stdint.h> +#include <sys/types.h> +#include <sys/endian.h> +#include <sys/sbuf.h> +#include <sys/queue.h> + +#include <stdio.h> +#include <stdlib.h> +#include <inttypes.h> +#include <unistd.h> +#include <string.h> +#include <strings.h> +#include <fcntl.h> +#include <ctype.h> +#include <limits.h> +#include <err.h> + +#include <cam/cam.h> +#include <cam/cam_debug.h> +#include <cam/cam_ccb.h> +#include <cam/scsi/scsi_all.h> +#include <cam/scsi/scsi_pass.h> +#include <cam/scsi/scsi_message.h> +#include <camlib.h> +#include "camcontrol.h" + +struct persist_transport_id { + struct scsi_transportid_header *hdr; + unsigned int alloc_len; + STAILQ_ENTRY(persist_transport_id) links; +}; + +/* + * Service Actions for PERSISTENT RESERVE IN. + */ +static struct scsi_nv persist_in_actions[] = { + { "read_keys", SPRI_RK }, + { "read_reservation", SPRI_RR }, + { "report_capabilities", SPRI_RC }, + { "read_full_status", SPRI_RS } +}; + +/* + * Service Actions for PERSISTENT RESERVE OUT. + */ +static struct scsi_nv persist_out_actions[] = { + { "register", SPRO_REGISTER }, + { "reserve", SPRO_RESERVE }, + { "release" , SPRO_RELEASE }, + { "clear", SPRO_CLEAR }, + { "preempt", SPRO_PREEMPT }, + { "preempt_abort", SPRO_PRE_ABO }, + { "register_ignore", SPRO_REG_IGNO }, + { "register_move", SPRO_REG_MOVE }, + { "replace_lost", SPRO_REPL_LOST_RES } +}; + +/* + * Known reservation scopes. As of SPC-4, only LU_SCOPE is used in the + * spec. The others are obsolete. + */ +static struct scsi_nv persist_scope_table[] = { + { "lun", SPR_LU_SCOPE }, + { "extent", SPR_EXTENT_SCOPE }, + { "element", SPR_ELEMENT_SCOPE } +}; + +/* + * Reservation types. The longer name for a given reservation type is + * listed first, so that it makes more sense when we print out the + * reservation type. We step through the table linearly when looking for + * the text name for a particular numeric reservation type value. + */ +static struct scsi_nv persist_type_table[] = { + { "read_shared", SPR_TYPE_RD_SHARED }, + { "write_exclusive", SPR_TYPE_WR_EX }, + { "wr_ex", SPR_TYPE_WR_EX }, + { "read_exclusive", SPR_TYPE_RD_EX }, + { "rd_ex", SPR_TYPE_RD_EX }, + { "exclusive_access", SPR_TYPE_EX_AC }, + { "ex_ac", SPR_TYPE_EX_AC }, + { "write_exclusive_reg_only", SPR_TYPE_WR_EX_RO }, + { "wr_ex_ro", SPR_TYPE_WR_EX_RO }, + { "exclusive_access_reg_only", SPR_TYPE_EX_AC_RO }, + { "ex_ac_ro", SPR_TYPE_EX_AC_RO }, + { "write_exclusive_all_regs", SPR_TYPE_WR_EX_AR }, + { "wr_ex_ar", SPR_TYPE_WR_EX_AR }, + { "exclusive_access_all_regs", SPR_TYPE_EX_AC_AR }, + { "ex_ac_ar", SPR_TYPE_EX_AC_AR } +}; + +/* + * Print out the standard scope/type field. + */ +static void +persist_print_scopetype(uint8_t scopetype) +{ + const char *tmpstr; + int num_entries; + + num_entries = sizeof(persist_scope_table) / + sizeof(persist_scope_table[0]); + tmpstr = scsi_nv_to_str(persist_scope_table, num_entries, + scopetype & SPR_SCOPE_MASK); + fprintf(stdout, "Scope: %s (%#x)\n", (tmpstr != NULL) ? tmpstr : + "Unknown", (scopetype & SPR_SCOPE_MASK) >> SPR_SCOPE_SHIFT); + + num_entries = sizeof(persist_type_table) / + sizeof(persist_type_table[0]); + tmpstr = scsi_nv_to_str(persist_type_table, num_entries, + scopetype & SPR_TYPE_MASK); + fprintf(stdout, "Type: %s (%#x)\n", (tmpstr != NULL) ? tmpstr : + "Unknown", scopetype & SPR_TYPE_MASK); +} + +static void +persist_print_transportid(uint8_t *buf, uint32_t len) +{ + struct sbuf *sb; + + sb = sbuf_new_auto(); + if (sb == NULL) + fprintf(stderr, "Unable to allocate sbuf\n"); + + scsi_transportid_sbuf(sb, (struct scsi_transportid_header *)buf, len); + + sbuf_finish(sb); + + fprintf(stdout, "%s\n", sbuf_data(sb)); + + sbuf_delete(sb); +} + +/* + * Print out a persistent reservation. This is used with the READ + * RESERVATION (0x01) service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_res(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length; + struct scsi_per_res_in_rsrv *res; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + res = (struct scsi_per_res_in_rsrv *)hdr; + + if (length < sizeof(res->data) - sizeof(res->data.extent_length)) { + if (length == 0) + fprintf(stdout, "No reservations.\n"); + else + warnx("unable to print reservation, only got %u " + "valid bytes", length); + return; + } + fprintf(stdout, "PRgeneration: %#x\n", + scsi_4btoul(res->header.generation)); + fprintf(stdout, "Reservation Key: %#jx\n", + (uintmax_t)scsi_8btou64(res->data.reservation)); + fprintf(stdout, "Scope address: %#x\n", + scsi_4btoul(res->data.scope_addr)); + + persist_print_scopetype(res->data.scopetype); + + fprintf(stdout, "Extent length: %u\n", + scsi_2btoul(res->data.extent_length)); +} + +/* + * Print out persistent reservation keys. This is used with the READ KEYS + * service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_keys(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length, num_keys, i; + struct scsi_per_res_key *key; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + num_keys = length / sizeof(*key); + + fprintf(stdout, "PRgeneration: %#x\n", scsi_4btoul(hdr->generation)); + fprintf(stdout, "%u key%s%s\n", num_keys, (num_keys == 1) ? "" : "s", + (num_keys == 0) ? "." : ":"); + + for (i = 0, key = (struct scsi_per_res_key *)&hdr[1]; i < num_keys; + i++, key++) { + fprintf(stdout, "%u: %#jx\n", i, + (uintmax_t)scsi_8btou64(key->key)); + } +} + +/* + * Print out persistent reservation capabilities. This is used with the + * REPORT CAPABILITIES service action of the PERSISTENT RESERVE IN command. + */ +static void +persist_print_cap(struct scsi_per_res_cap *cap, uint32_t valid_len) +{ + uint32_t length; + int check_type_mask = 0; + + length = scsi_2btoul(cap->length); + length = MIN(length, valid_len); + + if (length < __offsetof(struct scsi_per_res_cap, type_mask)) { + fprintf(stdout, "Insufficient data (%u bytes) to report " + "full capabilities\n", length); + return; + } + if (length >= __offsetof(struct scsi_per_res_cap, reserved)) + check_type_mask = 1; + + fprintf(stdout, "Replace Lost Reservation Capable (RLR_C): %d\n", + (cap->flags1 & SPRI_RLR_C) ? 1 : 0); + fprintf(stdout, "Compatible Reservation Handling (CRH): %d\n", + (cap->flags1 & SPRI_CRH) ? 1 : 0); + fprintf(stdout, "Specify Initiator Ports Capable (SIP_C): %d\n", + (cap->flags1 & SPRI_SIP_C) ? 1 : 0); + fprintf(stdout, "All Target Ports Capable (ATP_C): %d\n", + (cap->flags1 & SPRI_ATP_C) ? 1 : 0); + fprintf(stdout, "Persist Through Power Loss Capable (PTPL_C): %d\n", + (cap->flags1 & SPRI_PTPL_C) ? 1 : 0); + fprintf(stdout, "ALLOW COMMANDS field: (%#x)\n", + (cap->flags2 & SPRI_ALLOW_CMD_MASK) >> SPRI_ALLOW_CMD_SHIFT); + /* + * These cases are cut-and-pasted from SPC4r36l. There is no + * succinct way to describe these otherwise, and even with the + * verbose description, the user will probably have to refer to + * the spec to fully understand what is going on. + */ + switch (cap->flags2 & SPRI_ALLOW_CMD_MASK) { + case SPRI_ALLOW_1: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and does not provide information about whether the following commands\n" +" are allowed through Write Exclusive type reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE COPY RESULTS command, RECEIVE DIAGNOSTIC\n" +" RESULTS command, REPORT SUPPORTED OPERATION CODES command,\n" +" and REPORT SUPPORTED TASK MANAGEMENT FUNCTION command; and\n" +" b) the READ DEFECT DATA command (see SBC-3).\n"); + break; + case SPRI_ALLOW_2: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and does not allow the following commands through Write Exclusive type\n" +" reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n" +" The device server does not allow the RECEIVE COPY RESULTS command\n" +" through Write Exclusive type reservations or Exclusive Access type\n" +" reservations.\n"); + break; + case SPRI_ALLOW_3: + fprintf(stdout, +" The device server allows the TEST UNIT READY command through Write\n" +" Exclusive type reservations and Exclusive Access type reservations\n" +" and allows the following commands through Write Exclusive type\n" +" reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n" +" The device server does not allow the RECEIVE COPY RESULTS command\n" +" through Write Exclusive type reservations or Exclusive Access type\n" +" reservations.\n"); + break; + case SPRI_ALLOW_4: + fprintf(stdout, +" The device server allows the TEST UNIT READY command and the RECEIVE\n" +" COPY RESULTS command through Write Exclusive type reservations and\n" +" Exclusive Access type reservations and allows the following commands\n" +" through Write Exclusive type reservations:\n" +" a) the MODE SENSE command, READ ATTRIBUTE command, READ BUFFER\n" +" command, RECEIVE DIAGNOSTIC RESULTS command, REPORT SUPPORTED\n" +" OPERATION CODES command, and REPORT SUPPORTED TASK MANAGEMENT\n" +" FUNCTION command; and\n" +" b) the READ DEFECT DATA command.\n"); + break; + case SPRI_ALLOW_NA: + fprintf(stdout, +" No information is provided about whether certain commands are allowed\n" +" through certain types of persistent reservations.\n"); + break; + default: + fprintf(stdout, +" Unknown ALLOW COMMANDS value %#x\n", + (cap->flags2 & SPRI_ALLOW_CMD_MASK) >> + SPRI_ALLOW_CMD_SHIFT); + break; + } + fprintf(stdout, "Persist Through Power Loss Activated (PTPL_A): %d\n", + (cap->flags2 & SPRI_PTPL_A) ? 1 : 0); + if ((check_type_mask != 0) + && (cap->flags2 & SPRI_TMV)) { + fprintf(stdout, "Supported Persistent Reservation Types:\n"); + fprintf(stdout, " Write Exclusive - All Registrants " + "(WR_EX_AR): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0); + fprintf(stdout, " Exclusive Access - Registrants Only " + "(EX_AC_RO): %d\n", + (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0); + fprintf(stdout, " Write Exclusive - Registrants Only " + "(WR_EX_RO): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0); + fprintf(stdout, " Exclusive Access (EX_AC): %d\n", + (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0); + fprintf(stdout, " Write Exclusive (WR_EX): %d\n", + (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0); + fprintf(stdout, " Exclusive Access - All Registrants " + "(EX_AC_AR): %d\n", + (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0); + } else { + fprintf(stdout, "Persistent Reservation Type Mask is NOT " + "valid\n"); + } + + +} + +static void +persist_print_full(struct scsi_per_res_in_header *hdr, uint32_t valid_len) +{ + uint32_t length, len_to_go = 0; + struct scsi_per_res_in_full_desc *desc; + uint8_t *cur_pos; + int i; + + length = scsi_4btoul(hdr->length); + length = MIN(length, valid_len); + + if (length < sizeof(*desc)) { + if (length == 0) + fprintf(stdout, "No reservations.\n"); + else + warnx("unable to print reservation, only got %u " + "valid bytes", length); + return; + } + + fprintf(stdout, "PRgeneration: %#x\n", scsi_4btoul(hdr->generation)); + cur_pos = (uint8_t *)&hdr[1]; + for (len_to_go = length, i = 0, + desc = (struct scsi_per_res_in_full_desc *)cur_pos; + len_to_go >= sizeof(*desc); + desc = (struct scsi_per_res_in_full_desc *)cur_pos, i++) { + uint32_t additional_length, cur_length; + + + fprintf(stdout, "Reservation Key: %#jx\n", + (uintmax_t)scsi_8btou64(desc->res_key.key)); + fprintf(stdout, "All Target Ports (ALL_TG_PT): %d\n", + (desc->flags & SPRI_FULL_ALL_TG_PT) ? 1 : 0); + fprintf(stdout, "Reservation Holder (R_HOLDER): %d\n", + (desc->flags & SPRI_FULL_R_HOLDER) ? 1 : 0); + + if (desc->flags & SPRI_FULL_R_HOLDER) + persist_print_scopetype(desc->scopetype); + + if ((desc->flags & SPRI_FULL_ALL_TG_PT) == 0) + fprintf(stdout, "Relative Target Port ID: %#x\n", + scsi_2btoul(desc->rel_trgt_port_id)); + + additional_length = scsi_4btoul(desc->additional_length); + + persist_print_transportid(desc->transport_id, + additional_length); + + cur_length = sizeof(*desc) + additional_length; + len_to_go -= cur_length; + cur_pos += cur_length; + } +} + +int +scsipersist(struct cam_device *device, int argc, char **argv, char *combinedopt, + int retry_count, int timeout, int verbosemode, int err_recover) +{ + union ccb *ccb = NULL; + int c, in = 0, out = 0; + int action = -1, num_ids = 0; + int error = 0; + uint32_t res_len = 0; + unsigned long rel_tgt_port = 0; + uint8_t *res_buf = NULL; + int scope = SPR_LU_SCOPE, res_type = 0, key_set = 0, sa_key_set = 0; + struct persist_transport_id *id, *id2; + STAILQ_HEAD(, persist_transport_id) transport_id_list; + uint64_t key = 0, sa_key = 0; + struct scsi_nv *table = NULL; + size_t table_size = 0, id_len = 0; + uint32_t valid_len = 0; + int all_tg_pt = 0, aptpl = 0, spec_i_pt = 0, unreg = 0,rel_port_set = 0; + + STAILQ_INIT(&transport_id_list); + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + error = 1; + goto bailout; + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case 'a': + all_tg_pt = 1; + break; + case 'I': { + int error_str_len = 128; + char error_str[error_str_len]; + char *id_str; + + id = malloc(sizeof(*id)); + if (id == NULL) { + warnx("%s: error allocating %zu bytes", + __func__, sizeof(*id)); + error = 1; + goto bailout; + } + bzero(id, sizeof(*id)); + + id_str = strdup(optarg); + if (id_str == NULL) { + warnx("%s: error duplicating string %s", + __func__, optarg); + free(id); + error = 1; + goto bailout; + } + error = scsi_parse_transportid(id_str, &id->hdr, + &id->alloc_len, error_str, error_str_len); + if (error != 0) { + warnx("%s", error_str); + error = 1; + free(id); + free(id_str); + goto bailout; + } + free(id_str); + + STAILQ_INSERT_TAIL(&transport_id_list, id, links); + num_ids++; + id_len += id->alloc_len; + break; + } + case 'k': + case 'K': { + char *endptr; + uint64_t tmpval; + + tmpval = strtoumax(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid key argument %s", __func__, + optarg); + error = 1; + goto bailout; + } + if (c == 'k') { + key = tmpval; + key_set = 1; + } else { + sa_key = tmpval; + sa_key_set = 1; + } + break; + } + case 'i': + case 'o': { + scsi_nv_status status; + int table_entry = 0; + + if (c == 'i') { + in = 1; + table = persist_in_actions; + table_size = sizeof(persist_in_actions) / + sizeof(persist_in_actions[0]); + } else { + out = 1; + table = persist_out_actions; + table_size = sizeof(persist_out_actions) / + sizeof(persist_out_actions[0]); + } + + if ((in + out) > 1) { + warnx("%s: only one in (-i) or out (-o) " + "action is allowed", __func__); + error = 1; + goto bailout; + } + + status = scsi_get_nv(table, table_size, optarg, + &table_entry,SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + action = table[table_entry].value; + else { + warnx("%s: %s %s option %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", in ? "in" : + "out", optarg); + error = 1; + goto bailout; + } + break; + } + case 'p': + aptpl = 1; + break; + case 'R': { + char *endptr; + + rel_tgt_port = strtoul(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid relative target port %s", + __func__, optarg); + error = 1; + goto bailout; + } + rel_port_set = 1; + break; + } + case 's': { + size_t scope_size; + struct scsi_nv *scope_table = NULL; + scsi_nv_status status; + int table_entry = 0; + char *endptr; + + /* + * First check to see if the user gave us a numeric + * argument. If so, we'll try using it. + */ + if (isdigit(optarg[0])) { + scope = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid scope %s", + __func__, optarg); + error = 1; + goto bailout; + } + scope = (scope << SPR_SCOPE_SHIFT) & + SPR_SCOPE_MASK; + break; + } + + scope_size = sizeof(persist_scope_table) / + sizeof(persist_scope_table[0]); + scope_table = persist_scope_table; + status = scsi_get_nv(scope_table, scope_size, optarg, + &table_entry,SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + scope = scope_table[table_entry].value; + else { + warnx("%s: %s scope %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", optarg); + error = 1; + goto bailout; + } + break; + } + case 'S': + spec_i_pt = 1; + break; + case 'T': { + size_t res_type_size; + struct scsi_nv *rtype_table = NULL; + scsi_nv_status status; + char *endptr; + int table_entry = 0; + + /* + * First check to see if the user gave us a numeric + * argument. If so, we'll try using it. + */ + if (isdigit(optarg[0])) { + res_type = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid reservation type %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + } + + res_type_size = sizeof(persist_type_table) / + sizeof(persist_type_table[0]); + rtype_table = persist_type_table; + status = scsi_get_nv(rtype_table, res_type_size, + optarg, &table_entry, + SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + res_type = rtype_table[table_entry].value; + else { + warnx("%s: %s reservation type %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", optarg); + error = 1; + goto bailout; + } + break; + } + case 'U': + unreg = 1; + break; + default: + break; + } + } + + if ((in + out) != 1) { + warnx("%s: you must specify one of -i or -o", __func__); + error = 1; + goto bailout; + } + + /* + * Note that we don't really try to figure out whether the user + * needs to specify one or both keys. There are a number of + * scenarios, and sometimes 0 is a valid and desired value. + */ + if (in != 0) { + switch (action) { + case SPRI_RK: + case SPRI_RR: + case SPRI_RS: + /* + * Allocate the maximum length possible for these + * service actions. According to the spec, the + * target is supposed to return the available + * length in the header, regardless of the + * allocation length. In practice, though, with + * the READ FULL STATUS (SPRI_RS) service action, + * some Seagate drives (in particular a + * Constellation ES, <SEAGATE ST32000444SS 0006>) + * don't return the available length if you only + * allocate the length of the header. So just + * allocate the maximum here so we don't miss + * anything. + */ + res_len = SPRI_MAX_LEN; + break; + case SPRI_RC: + res_len = sizeof(struct scsi_per_res_cap); + break; + default: + /* In theory we should catch this above */ + warnx("%s: invalid action %d", __func__, action); + error = 1; + goto bailout; + break; + } + } else { + + /* + * XXX KDM need to add length for transport IDs for the + * register and move service action and the register + * service action with the SPEC_I_PT bit set. + */ + if (action == SPRO_REG_MOVE) { + if (num_ids != 1) { + warnx("%s: register and move requires a " + "single transport ID (-I)", __func__); + error = 1; + goto bailout; + } + if (rel_port_set == 0) { + warnx("%s: register and move requires a " + "relative target port (-R)", __func__); + error = 1; + goto bailout; + } + res_len = sizeof(struct scsi_per_res_reg_move) + id_len; + } else { + res_len = sizeof(struct scsi_per_res_out_parms); + if ((action == SPRO_REGISTER) + && (num_ids != 0)) { + /* + * If the user specifies any IDs with the + * register service action, turn on the + * spec_i_pt bit. + */ + spec_i_pt = 1; + res_len += id_len; + res_len += + sizeof(struct scsi_per_res_out_trans_ids); + } + } + } +retry: + if (res_buf != NULL) { + free(res_buf); + res_buf = NULL; + } + res_buf = malloc(res_len); + if (res_buf == NULL) { + warn("%s: error allocating %d bytes", __func__, res_len); + error = 1; + goto bailout; + } + bzero(res_buf, res_len); + + if (in != 0) { + scsi_persistent_reserve_in(&ccb->csio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*service_action*/ action, + /*data_ptr*/ res_buf, + /*dxfer_len*/ res_len, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ timeout ? timeout :5000); + + } else { + switch (action) { + case SPRO_REGISTER: + if (spec_i_pt != 0) { + struct scsi_per_res_out_trans_ids *id_hdr; + uint8_t *bufptr; + + bufptr = res_buf + + sizeof(struct scsi_per_res_out_parms) + + sizeof(struct scsi_per_res_out_trans_ids); + STAILQ_FOREACH(id, &transport_id_list, links) { + bcopy(id->hdr, bufptr, id->alloc_len); + bufptr += id->alloc_len; + } + id_hdr = (struct scsi_per_res_out_trans_ids *) + (res_buf + + sizeof(struct scsi_per_res_out_parms)); + scsi_ulto4b(id_len, id_hdr->additional_length); + } + case SPRO_REG_IGNO: + case SPRO_PREEMPT: + case SPRO_PRE_ABO: + case SPRO_RESERVE: + case SPRO_RELEASE: + case SPRO_CLEAR: + case SPRO_REPL_LOST_RES: { + struct scsi_per_res_out_parms *parms; + + parms = (struct scsi_per_res_out_parms *)res_buf; + + scsi_u64to8b(key, parms->res_key.key); + scsi_u64to8b(sa_key, parms->serv_act_res_key); + if (spec_i_pt != 0) + parms->flags |= SPR_SPEC_I_PT; + if (all_tg_pt != 0) + parms->flags |= SPR_ALL_TG_PT; + if (aptpl != 0) + parms->flags |= SPR_APTPL; + break; + } + case SPRO_REG_MOVE: { + struct scsi_per_res_reg_move *reg_move; + uint8_t *bufptr; + + reg_move = (struct scsi_per_res_reg_move *)res_buf; + + scsi_u64to8b(key, reg_move->res_key.key); + scsi_u64to8b(sa_key, reg_move->serv_act_res_key); + if (unreg != 0) + reg_move->flags |= SPR_REG_MOVE_UNREG; + if (aptpl != 0) + reg_move->flags |= SPR_REG_MOVE_APTPL; + scsi_ulto2b(rel_tgt_port, reg_move->rel_trgt_port_id); + id = STAILQ_FIRST(&transport_id_list); + /* + * This shouldn't happen, since we already checked + * the number of IDs above. + */ + if (id == NULL) { + warnx("%s: No transport IDs found!", __func__); + error = 1; + goto bailout; + } + bufptr = (uint8_t *)®_move[1]; + bcopy(id->hdr, bufptr, id->alloc_len); + scsi_ulto4b(id->alloc_len, + reg_move->transport_id_length); + break; + } + default: + break; + } + scsi_persistent_reserve_out(&ccb->csio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*service_action*/ action, + /*scope*/ scope, + /*res_type*/ res_type, + /*data_ptr*/ res_buf, + /*dxfer_len*/ res_len, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ timeout ?timeout :5000); + } + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (err_recover != 0) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending PERSISTENT RESERVE %s", (in != 0) ? + "IN" : "OUT"); + + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + error = 1; + goto bailout; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + error = 1; + goto bailout; + } + + if (in == 0) + goto bailout; + + valid_len = res_len - ccb->csio.resid; + + switch (action) { + case SPRI_RK: + case SPRI_RR: + case SPRI_RS: { + struct scsi_per_res_in_header *hdr; + uint32_t hdr_len; + + if (valid_len < sizeof(*hdr)) { + warnx("%s: only got %d valid bytes, need %zd", + __func__, valid_len, sizeof(*hdr)); + error = 1; + goto bailout; + } + hdr = (struct scsi_per_res_in_header *)res_buf; + hdr_len = scsi_4btoul(hdr->length); + + if (hdr_len > (res_len - sizeof(*hdr))) { + res_len = hdr_len + sizeof(*hdr); + goto retry; + } + + if (action == SPRI_RK) { + persist_print_keys(hdr, valid_len); + } else if (action == SPRI_RR) { + persist_print_res(hdr, valid_len); + } else { + persist_print_full(hdr, valid_len); + } + break; + } + case SPRI_RC: { + struct scsi_per_res_cap *cap; + uint32_t cap_len; + + if (valid_len < sizeof(*cap)) { + warnx("%s: only got %u valid bytes, need %zd", + __func__, valid_len, sizeof(*cap)); + error = 1; + goto bailout; + } + cap = (struct scsi_per_res_cap *)res_buf; + cap_len = scsi_2btoul(cap->length); + if (cap_len != sizeof(*cap)) { + /* + * We should be able to deal with this, + * it's just more trouble. + */ + warnx("%s: reported size %u is different " + "than expected size %zd", __func__, + cap_len, sizeof(*cap)); + } + + /* + * If there is more data available, grab it all, + * even though we don't really know what to do with + * the extra data since it obviously wasn't in the + * spec when this code was written. + */ + if (cap_len > res_len) { + res_len = cap_len; + goto retry; + } + persist_print_cap(cap, valid_len); + break; + } + default: + break; + } + +bailout: + free(res_buf); + + if (ccb != NULL) + cam_freeccb(ccb); + + STAILQ_FOREACH_SAFE(id, &transport_id_list, links, id2) { + STAILQ_REMOVE(&transport_id_list, id, persist_transport_id, + links); + free(id); + } + return (error); +} diff --git a/sbin/casperd/casperd.8 b/sbin/casperd/casperd.8 index ebe560d..d60b9f3 100644 --- a/sbin/casperd/casperd.8 +++ b/sbin/casperd/casperd.8 @@ -122,5 +122,5 @@ daemon exits 0 on success, and >0 if an error occurs. The .Nm was implemented by -.An Pawel Jakub Dawidek Aq pawel@dawidek.net +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net under sponsorship from the FreeBSD Foundation. diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 7c2e531..78b9eb6 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -43,8 +43,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/capsicum.h> - #include "dhcpd.h" #include "privsep.h" #include <sys/capsicum.h> diff --git a/sbin/dhclient/dhclient-script.8 b/sbin/dhclient/dhclient-script.8 index fdb46a7..2fae9f6 100644 --- a/sbin/dhclient/dhclient-script.8 +++ b/sbin/dhclient/dhclient-script.8 @@ -273,7 +273,7 @@ but current scripts do not do this. The original version of .Nm was written for the Internet Software Consortium by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com in cooperation with Vixie Enterprises. .Pp The @@ -281,7 +281,7 @@ The implementation of .Nm was written by -.An Kenneth R. Westerback Aq krw@openbsd.org . +.An Kenneth R. Westerback Aq Mt krw@openbsd.org . .Sh BUGS If more than one interface is being used, there is no obvious way to avoid clashes between server-supplied configuration parameters - for diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8 index d2b8f437..c6940da 100644 --- a/sbin/dhclient/dhclient.8 +++ b/sbin/dhclient/dhclient.8 @@ -188,9 +188,9 @@ The .Nm utility was written by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com and -.An Elliot Poger Aq elliot@poger.com . +.An Elliot Poger Aq Mt elliot@poger.com . .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index c43bda9..22b21f1 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -56,8 +56,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/capsicum.h> - #include "dhcpd.h" #include "privsep.h" diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 167239e..3b6ae04 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -537,8 +537,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhclient.leases.5 b/sbin/dhclient/dhclient.leases.5 index b1f0f3d..f48b106 100644 --- a/sbin/dhclient/dhclient.leases.5 +++ b/sbin/dhclient/dhclient.leases.5 @@ -88,8 +88,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/dhclient/dhcp-options.5 b/sbin/dhclient/dhcp-options.5 index 1405839..4b65fa7 100644 --- a/sbin/dhclient/dhcp-options.5 +++ b/sbin/dhclient/dhcp-options.5 @@ -603,8 +603,8 @@ The .Xr dhcpd 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c index dd68e67..f7f117a 100644 --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -235,6 +235,8 @@ set_port_media(struct cfg *cfg, char *argv[]) p.es_ifmr.ifm_count = IFMEDIAREQ_NULISTENTRIES; if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); + if (p.es_ifmr.ifm_count == 0) + return; subtype = get_media_subtype(IFM_TYPE(ifm_ulist[0]), argv[1]); p.es_ifr.ifr_media = (p.es_ifmr.ifm_current & IFM_IMASK) | IFM_TYPE(ifm_ulist[0]) | subtype; diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 34b96ef..819c1c7 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -507,7 +507,6 @@ print_part(const struct dos_partition *partp) static void init_boot(void) { -#ifndef __ia64__ const char *fname; int fdesc, n; struct stat sb; @@ -529,15 +528,6 @@ init_boot(void) err(1, "%s", fname); if (n != mboot.bootinst_size) errx(1, "%s: short read", fname); -#else - if (mboot.bootinst != NULL) - free(mboot.bootinst); - mboot.bootinst_size = secsize; - if ((mboot.bootinst = malloc(mboot.bootinst_size)) == NULL) - errx(1, "unable to allocate boot block buffer"); - memset(mboot.bootinst, 0, mboot.bootinst_size); - le16enc(&mboot.bootinst[DOSMAGICOFFSET], DOSMAGIC); -#endif } diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 9753cf7..d3c8e9f 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -134,9 +134,9 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM .Sh BUGS Snapshots are handled like plain files. They should get their own level to provide for independent control of the diff --git a/sbin/fsck_msdosfs/check.c b/sbin/fsck_msdosfs/check.c index 1fb005d..083389e 100644 --- a/sbin/fsck_msdosfs/check.c +++ b/sbin/fsck_msdosfs/check.c @@ -142,7 +142,7 @@ checkfilesys(const char *fname) goto out; /* now write the FATs */ - if (mod & FSFATMOD) { + if (mod & (FSFATMOD|FSFIXFAT)) { if (ask(1, "Update FATs")) { mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); if (mod & FSFATAL) diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index 008d0b3..e8d6475 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -206,7 +206,7 @@ static char longName[DOSLONGNAMELEN] = ""; static u_char *buffer = NULL; static u_char *delbuf = NULL; -struct dosDirEntry *rootDir; +static struct dosDirEntry *rootDir; static struct dosDirEntry *lostDir; /* @@ -419,13 +419,14 @@ checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, fullpath(dir)); if (ask(1, "Drop superfluous clusters")) { cl_t cl; - u_int32_t sz = 0; + u_int32_t sz, len; - for (cl = dir->head; (sz += boot->ClusterSize) < - dir->size;) + for (cl = dir->head, len = sz = 0; + (sz += boot->ClusterSize) < dir->size; len++) cl = fat[cl].next; clearchain(boot, fat, fat[cl].next); fat[cl].next = CLUST_EOF; + fat[dir->head].length = len; return FSFATMOD; } else return FSERROR; diff --git a/sbin/fsck_msdosfs/ext.h b/sbin/fsck_msdosfs/ext.h index 681cde9..ef9c420 100644 --- a/sbin/fsck_msdosfs/ext.h +++ b/sbin/fsck_msdosfs/ext.h @@ -26,7 +26,7 @@ */ #ifndef EXT_H -#define EXT_H +#define EXT_H #include <sys/types.h> @@ -43,8 +43,6 @@ extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ -extern struct dosDirEntry *rootDir; - /* * function declarations */ @@ -71,8 +69,8 @@ int checkfilesys(const char *); #define FSFATMOD 4 /* The FAT was modified */ #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ -#define FSDIRTY 32 /* File system is dirty */ -#define FSFIXFAT 64 /* Fix file system FAT */ +#define FSDIRTY 32 /* File system is dirty */ +#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c index d2d1444..b509c50 100644 --- a/sbin/fsck_msdosfs/fat.c +++ b/sbin/fsck_msdosfs/fat.c @@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp) ret |= FSDIRTY; else { /* just some odd byte sequence in FAT */ - + switch (boot->ClustMask) { case CLUST32_MASK: pwarn("%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n", @@ -262,7 +262,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp) break; } - + if (ask(1, "Correct")) ret |= FSFIXFAT; } @@ -436,7 +436,15 @@ tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *truncp) clearchain(boot, fat, head); return FSFATMOD; } else if (ask(0, "Truncate")) { + uint32_t len; + cl_t p; + + for (p = head, len = 0; + p >= CLUST_FIRST && p < boot->NumClusters; + p = fat[p].next, len++) + continue; *truncp = CLUST_EOF; + fat[head].length = len; return FSFATMOD; } else return FSERROR; @@ -465,7 +473,8 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) /* follow the chain and mark all clusters on the way */ for (len = 0, p = head; - p >= CLUST_FIRST && p < boot->NumClusters; + p >= CLUST_FIRST && p < boot->NumClusters && + fat[p].head != head; p = fat[p].next) { fat[p].head = head; len++; @@ -486,10 +495,10 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) continue; /* follow the chain to its end (hopefully) */ - for (p = head; + for (len = fat[head].length, p = head; (n = fat[p].next) >= CLUST_FIRST && n < boot->NumClusters; p = n) - if (fat[n].head != head) + if (fat[n].head != head || len-- < 2) break; if (n >= CLUST_EOFS) continue; @@ -497,14 +506,20 @@ checkfat(struct bootblock *boot, struct fatEntry *fat) if (n == CLUST_FREE || n >= CLUST_RSRVD) { pwarn("Cluster chain starting at %u ends with cluster marked %s\n", head, rsrvdcltype(n)); +clear: ret |= tryclear(boot, fat, head, &fat[p].next); continue; } if (n < CLUST_FIRST || n >= boot->NumClusters) { pwarn("Cluster chain starting at %u ends with cluster out of range (%u)\n", - head, n); - ret |= tryclear(boot, fat, head, &fat[p].next); - continue; + head, n); + goto clear; + } + if (head == fat[n].head) { + pwarn("Cluster chain starting at %u loops at cluster %u\n", + + head, p); + goto clear; } pwarn("Cluster chains starting at %u and %u are linked at cluster %u\n", head, fat[n].head, n); @@ -621,13 +636,15 @@ writefat(int fs, struct bootblock *boot, struct fatEntry *fat, int correct_fat) default: if (fat[cl].next == CLUST_FREE) boot->NumFree++; - if (cl + 1 < boot->NumClusters - && fat[cl + 1].next == CLUST_FREE) - boot->NumFree++; *p++ = (u_char)fat[cl].next; - *p++ = (u_char)((fat[cl].next >> 8) & 0xf) - |(u_char)(fat[cl+1].next << 4); - *p++ = (u_char)(fat[++cl].next >> 4); + *p = (u_char)((fat[cl].next >> 8) & 0xf); + cl++; + if (cl >= boot->NumClusters) + break; + if (fat[cl].next == CLUST_FREE) + boot->NumFree++; + *p++ |= (u_char)(fat[cl + 1].next << 4); + *p++ = (u_char)(fat[cl + 1].next >> 4); break; } } @@ -653,7 +670,7 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) cl_t head; int mod = FSOK; int ret; - + for (head = CLUST_FIRST; head < boot->NumClusters; head++) { /* find next untravelled chain */ if (fat[head].head != head @@ -677,8 +694,9 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat) if (boot->bpbFSInfo) { ret = 0; - if (boot->FSFree != boot->NumFree) { - pwarn("Free space in FSInfo block (%d) not correct (%d)\n", + if (boot->FSFree != 0xffffffffU && + boot->FSFree != boot->NumFree) { + pwarn("Free space in FSInfo block (%u) not correct (%u)\n", boot->FSFree, boot->NumFree); if (ask(1, "Fix")) { boot->FSFree = boot->NumFree; diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile index f921e89..21ac09f 100644 --- a/sbin/fsdb/Makefile +++ b/sbin/fsdb/Makefile @@ -9,8 +9,8 @@ SRCS= fsdb.c fsdbutil.c \ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c CFLAGS+= -I${.CURDIR}/../fsck_ffs WARNS?= 2 -LDADD= -ledit -ltermcap -DPADD= ${LIBEDIT} ${LIBTERMCAP} +LDADD= -ledit -ltermcapw +DPADD= ${LIBEDIT} ${LIBTERMCAPW} .PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs .include <bsd.prog.mk> diff --git a/sbin/fsirand/fsirand.8 b/sbin/fsirand/fsirand.8 index 3156787..f3fbd8d 100644 --- a/sbin/fsirand/fsirand.8 +++ b/sbin/fsirand/fsirand.8 @@ -107,7 +107,7 @@ A version first appeared in .Fx 2.2.5 . .Sh AUTHORS -.An Todd C. Miller Aq Todd.Miller@courtesan.com +.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com .Sh CAVEATS Since .Nm diff --git a/sbin/gbde/gbde.8 b/sbin/gbde/gbde.8 index efd3156..47c2e21 100644 --- a/sbin/gbde/gbde.8 +++ b/sbin/gbde/gbde.8 @@ -243,14 +243,14 @@ To destroy all copies of the masterkey: This software was developed for the .Fx Project by -.An "Poul-Henning Kamp" +.An Poul-Henning Kamp and NAI Labs, the Security Research Division of Network Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035 .Pq Dq CBOSS , as part of the DARPA CHATS research program. .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .Sh BUGS The cryptographic algorithms and the overall design have not been attacked mercilessly for over 10 years by a gang of cryptoanalysts. diff --git a/sbin/geom/class/cache/gcache.8 b/sbin/geom/class/cache/gcache.8 index b9f03bd..b0f1c7a 100644 --- a/sbin/geom/class/cache/gcache.8 +++ b/sbin/geom/class/cache/gcache.8 @@ -189,4 +189,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org diff --git a/sbin/geom/class/concat/gconcat.8 b/sbin/geom/class/concat/gconcat.8 index b797a1c..d874b08 100644 --- a/sbin/geom/class/concat/gconcat.8 +++ b/sbin/geom/class/concat/gconcat.8 @@ -194,4 +194,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/eli/geli.8 b/sbin/geom/class/eli/geli.8 index 53c1daf..c435859 100644 --- a/sbin/geom/class/eli/geli.8 +++ b/sbin/geom/class/eli/geli.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd June 18, 2014 .Dt GELI 8 .Os .Sh NAME @@ -331,7 +331,7 @@ key length. .It Nm AES-XTS .Em 128 , 256 -.It Nm AES-CBC , Nm Camilla-CBC +.It Nm AES-CBC , Nm Camellia-CBC .Em 128 , 192, 256 @@ -353,13 +353,14 @@ because encryption/decryption which requires an initialization vector is done per sector; fewer sectors means less computational work. .It Fl V Ar version Metadata version to use. -This option is helpful when creating provider that may be used by older +This option is helpful when creating a provider that may be used by older .Nm FreeBSD/GELI versions. Consult the .Sx HISTORY section to find which metadata version is supported by which FreeBSD version. -Note that using older metadata version may limit numer of features available. +Note that using an older version of metadata may limit the number of +features available. .El .It Cm attach Attach the given provider. @@ -619,7 +620,7 @@ devices. .El .It Cm resume Resume previously suspended device. -The caller must ensure that executing this subcommand doesn't access the +The caller must ensure that executing this subcommand does not access the suspended device, leading to a deadlock. For example suspending a device which contains the file system where the .Nm @@ -823,7 +824,7 @@ Enter passphrase: .Pp Create an encrypted provider, but use two User Keys: one for your employee and one for you as the company's security officer -(so it's not a tragedy if the employee +(so it is not a tragedy if the employee .Qq accidentally forgets his passphrase): .Bd -literal -offset indent @@ -1056,4 +1057,4 @@ metadata version supported by the given FreeBSD version: .It Li 10.0 Ta 7 .El .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/journal/gjournal.8 b/sbin/geom/class/journal/gjournal.8 index edef902..6eb8cde 100644 --- a/sbin/geom/class/journal/gjournal.8 +++ b/sbin/geom/class/journal/gjournal.8 @@ -343,4 +343,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/label/glabel.8 b/sbin/geom/class/label/glabel.8 index 72b6dae..c950e26 100644 --- a/sbin/geom/class/label/glabel.8 +++ b/sbin/geom/class/label/glabel.8 @@ -272,4 +272,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/mirror/gmirror.8 b/sbin/geom/class/mirror/gmirror.8 index bca5bdb..fb501ca 100644 --- a/sbin/geom/class/mirror/gmirror.8 +++ b/sbin/geom/class/mirror/gmirror.8 @@ -376,7 +376,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a way to change a component's priority inside a running mirror. .Pp diff --git a/sbin/geom/class/mountver/gmountver.8 b/sbin/geom/class/mountver/gmountver.8 index 02d77db..c9a9c0a 100644 --- a/sbin/geom/class/mountver/gmountver.8 +++ b/sbin/geom/class/mountver/gmountver.8 @@ -127,4 +127,4 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org diff --git a/sbin/geom/class/multipath/gmultipath.8 b/sbin/geom/class/multipath/gmultipath.8 index 81b85dd..07ac01e 100644 --- a/sbin/geom/class/multipath/gmultipath.8 +++ b/sbin/geom/class/multipath/gmultipath.8 @@ -360,6 +360,6 @@ GEOM_MULTIPATH: da2 added to FRED .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh AUTHOR -.An Matthew Jacob Aq mjacob@FreeBSD.org -.An Alexander Motin Aq mav@FreeBSD.org +.Sh AUTHORS +.An Matthew Jacob Aq Mt mjacob@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/sbin/geom/class/nop/gnop.8 b/sbin/geom/class/nop/gnop.8 index 2bcbef3..4770090 100644 --- a/sbin/geom/class/nop/gnop.8 +++ b/sbin/geom/class/nop/gnop.8 @@ -176,4 +176,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8 index 8714eed..e8c4dab 100644 --- a/sbin/geom/class/part/gpart.8 +++ b/sbin/geom/class/part/gpart.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 11, 2014 +.Dd August 12, 2014 .Dt GPART 8 .Os .Sh NAME @@ -129,6 +129,14 @@ .Op Fl f Ar flags .Ar geom .\" +.Nm +.Cm list +.Nm +.Cm status +.Nm +.Cm load +.Nm +.Cm unload .Sh DESCRIPTION The .Nm @@ -467,6 +475,18 @@ See the section entitled below for a discussion about its use. .El +.It Cm list +See +.Xr geom 8 . +.It Cm status +See +.Xr geom 8 . +.It Cm load +See +.Xr geom 8 . +.It Cm unload +See +.Xr geom 8 . .El .Sh PARTITIONING SCHEMES Several partitioning schemes are supported by the @@ -550,8 +570,20 @@ The .Nm utility also allows the user to specify scheme-specific partition types for partition types that do not have symbolic names. -Symbolic names currently understood are: -.Bl -tag -width ".Cm ms-ldm-metadata" +Symbolic names currently understood and used by +.Fx +are: +.Bl -tag -width ".Cm dragonfly-disklabel64" +.It Cm apple-boot +The system partition dedicated to storing boot loaders on some Apple +systems. +The scheme-specific types are +.Qq Li "!171" +for MBR, +.Qq Li "!Apple_Bootstrap" +for APM, and +.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac" +for GPT. .It Cm bios-boot The system partition dedicated to second stage of the boot loader program. Usually it is used by the GRUB 2 loader for GPT partitioning schemes. @@ -563,16 +595,6 @@ Interface (EFI). In such cases, the GPT partitioning scheme is used and the actual partition type for the system partition can also be specified as .Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b" . -.It Cm fat16 -A partition that contains a FAT16 filesystem. -The scheme-specific type is -.Qq Li "!6" -for MBR. -.It Cm fat32 -A partition that contains a FAT32 filesystem. -The scheme-specific type is -.Qq Li "!11" -for MBR. .It Cm freebsd A .Fx @@ -631,6 +653,138 @@ The scheme-specific types are for APM, .Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT, and 0x0904 for VTOC8. +.El +.Pp +Another symbolic names that can be used with +.Cm gpart +utility are: +.Bl -tag -width ".Cm dragonfly-disklabel64" +.It Cm apple-hfs +An Apple Mac OS X partition that contains a HFS or HFS+ filesystem. +The scheme-specific types are +.Qq Li "!Apple_HFS" +for APM and +.Qq Li "!48465300-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-label +An Apple Mac OS X partition dedicated to partition metadata that descibes +disk device. +The scheme-specific type is +.Qq Li "!4c616265-6c00-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-raid +An Apple Mac OS X partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!52414944-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-raid-offline +An Apple Mac OS X partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!52414944-5f4f-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-tv-recovery +An Apple Mac OS X partition used by Apple TV. +The scheme-specific type is +.Qq Li "!5265636f-7665-11aa-aa11-00306543ecac" +for GPT. +.It Cm apple-ufs +An Apple Mac OS X partition that contains a UFS filesystem. +The scheme-specific types are +.Qq Li "!Apple_UNIX_SVR2" +for APM and +.Qq Li "!55465300-0000-11aa-aa11-00306543ecac" +for GPT. +.It Cm dragonfly-label32 +A DragonFlyBSD partition subdivided into filesystems with a +.Bx +disklabel. +The scheme-specific type is +.Qq Li "!9d087404-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-label64 +A DragonFlyBSD partition subdivided into filesystems with a +disklabel64. +The scheme-specific type is +.Qq Li "!3d48ce54-1d16-11dc-8696-01301bb8a9f5" +for GPT. +.It Cm dragonfly-legacy +A legacy partition type used in DragonFlyBSD. +The scheme-specific type is +.Qq Li "!bd215ab2-1d16-11dc-8696-01301bb8a9f5" +for GPT. +.It Cm dragonfly-ccd +A DragonFlyBSD partition used with Concatenated Disk driver. +The scheme-specific type is +.Qq Li "!dbd5211b-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-hammer +A DragonFlyBSD partition that contains a Hammer filesystem. +The scheme-specific type is +.Qq Li "!61dc63ac-6e38-11dc-8513-01301bb8a9f5" +for GPT. +.It Cm dragonfly-hammer2 +A DragonFlyBSD partition that contains a Hammer2 filesystem. +The scheme-specific type is +.Qq Li "!5cbb9ad1-862d-11dc-a94d-01301bb8a9f5" +for GPT. +.It Cm dragonfly-swap +A DragonFlyBSD partition dedicated to swap space. +The scheme-specific type is +.Qq Li "!9d58fdbd-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-ufs +A DragonFlyBSD partition that contains an UFS1 filesystem. +The scheme-specific type is +.Qq Li "!9d94ce7c-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm dragonfly-vinum +A DragonFlyBSD partition used with Logical Volume Manager. +The scheme-specific type is +.Qq Li "!9dd4478f-1ca5-11dc-8817-01301bb8a9f5" +for GPT. +.It Cm ebr +A partition subdivided into filesystems with a EBR. +The scheme-specific type is +.Qq Li "!5" +for MBR. +.It Cm fat16 +A partition that contains a FAT16 filesystem. +The scheme-specific type is +.Qq Li "!6" +for MBR. +.It Cm fat32 +A partition that contains a FAT32 filesystem. +The scheme-specific type is +.Qq Li "!11" +for MBR. +.It Cm linux-data +A Linux partition that contains some filesystem with data. +The scheme-specific types are +.Qq Li "!131" +for MBR and +.Qq Li "!0fc63daf-8483-4772-8e79-3d69d8477de4" +for GPT. +.It Cm linux-lvm +A Linux partition dedicated to Logical Volume Manager. +The scheme-specific types are +.Qq Li "!142" +for MBR and +.Qq Li "!e6d6d379-f507-44c2-a23c-238f2a3df928" +for GPT. +.It Cm linux-raid +A Linux partition used in a software RAID configuration. +The scheme-specific types are +.Qq Li "!253" +for MBR and +.Qq Li "!a19d880f-05fc-4d3b-a006-743f0f84911e" +for GPT. +.It Cm linux-swap +A Linux partition dedicated to swap space. +The scheme-specific types are +.Qq Li "!130" +for MBR and +.Qq Li "!0657fd6d-a4ab-43c4-84e5-0933c84b4f4f" +for GPT. .It Cm mbr A partition that is sub-partitioned by a Master Boot Record (MBR). This type is known as @@ -658,11 +812,49 @@ A partition that contains Logical Disk Manager (LDM) database. The scheme-specific type is .Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3" for GPT. +.It Cm netbsd-ccd +A NetBSD partition used with Concatenated Disk driver. +The scheme-specific type is +.Qq Li "!2db519c4-b10f-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-cgd +An encrypted NetBSD partition. +The scheme-specific type is +.Qq Li "!2db519ec-b10f-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-ffs +A NetBSD partition that contains an UFS filesystem. +The scheme-specific type is +.Qq Li "!49f48d5a-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-lfs +A NetBSD partition that contains an LFS filesystem. +The scheme-specific type is +.Qq Li "!49f48d82-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-raid +A NetBSD partition used in a software RAID configuration. +The scheme-specific type is +.Qq Li "!49f48daa-b10e-11dc-b99b-0019d1879648" +for GPT. +.It Cm netbsd-swap +A NetBSD partition dedicated to swap space. +The scheme-specific type is +.Qq Li "!49f48d32-b10e-11dc-b99b-0019d1879648" +for GPT. .It Cm ntfs A partition that contains a NTFS or exFAT filesystem. The scheme-specific type is .Qq Li "!7" for MBR. +.It Cm prep-boot +The system partition dedicated to storing boot loaders on some PowerPC systems, +notably those made by IBM. +The scheme-specific types are +.Qq Li "!65" +for MBR and +.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b" +for GPT. .It Cm vmware-vmfs A partition that contains a VMware File System (VMFS). The scheme-specific types are @@ -858,7 +1050,7 @@ Instead, the 800 KBytes bootstrap code image should be written with the .Cm gpart bootcode command to a partition of type -.Cm freebsd-boot , +.Cm apple-boot , which should also be 800 KB in size. .Sh OPERATIONAL FLAGS Actions other than the @@ -984,6 +1176,12 @@ If this variable set to 1 each component of the mirrored volume will be present as independent partition. .Em NOTE : This may break a mirrored volume and lead to data damage. +.It Va kern.geom.part.mbr.enforce_chs : No 0 +Specify how the Master Boot Record (MBR) module does alignment. +If this variable is set to a non-zero value, the module will automatically +recalculate the user-specified offset and size for alignment with the CHS +geometry. +Otherwise the values will be left unchanged. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. @@ -1127,4 +1325,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Marcel Moolenaar Aq marcel@FreeBSD.org +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org diff --git a/sbin/geom/class/raid/graid.8 b/sbin/geom/class/raid/graid.8 index 47d7fa2..496e44e 100644 --- a/sbin/geom/class/raid/graid.8 +++ b/sbin/geom/class/raid/graid.8 @@ -320,5 +320,5 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org -.An M. Warner Losh Aq imp@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org +.An M. Warner Losh Aq Mt imp@FreeBSD.org diff --git a/sbin/geom/class/raid3/graid3.8 b/sbin/geom/class/raid3/graid3.8 index a82d388..426c94d 100644 --- a/sbin/geom/class/raid3/graid3.8 +++ b/sbin/geom/class/raid3/graid3.8 @@ -248,7 +248,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a section with an implementation description. .Pp diff --git a/sbin/geom/class/sched/gsched.8 b/sbin/geom/class/sched/gsched.8 index ae04865..facb5c1 100644 --- a/sbin/geom/class/sched/gsched.8 +++ b/sbin/geom/class/sched/gsched.8 @@ -158,5 +158,5 @@ The utility first appeared in .Fx 8.1 . .Sh AUTHORS -.An Fabio Checconi Aq fabio@FreeBSD.org -.An Luigi Rizzo Aq luigi@FreeBSD.org +.An Fabio Checconi Aq Mt fabio@FreeBSD.org +.An Luigi Rizzo Aq Mt luigi@FreeBSD.org diff --git a/sbin/geom/class/shsec/gshsec.8 b/sbin/geom/class/shsec/gshsec.8 index f72c31c..dcfd2b3 100644 --- a/sbin/geom/class/shsec/gshsec.8 +++ b/sbin/geom/class/shsec/gshsec.8 @@ -127,4 +127,4 @@ The utility appeared in .Fx 5.4 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/stripe/gstripe.8 b/sbin/geom/class/stripe/gstripe.8 index 33ef30b..f1f34fe 100644 --- a/sbin/geom/class/stripe/gstripe.8 +++ b/sbin/geom/class/stripe/gstripe.8 @@ -240,4 +240,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/geom/class/virstor/gvirstor.8 b/sbin/geom/class/virstor/gvirstor.8 index 0273cb4..3d93e5b 100644 --- a/sbin/geom/class/virstor/gvirstor.8 +++ b/sbin/geom/class/virstor/gvirstor.8 @@ -257,6 +257,10 @@ The .Nm utility first appeared in .Fx 7.0 . +.Sh AUTHORS +.An Ivan Voras Aq Mt ivoras@FreeBSD.org +.Pp +Sponsored by Google Summer of Code 2006. .Sh BUGS Commands .Cm add @@ -293,7 +297,3 @@ and all their structures will be physically allocated at the start of the first virstor component. This could have a significant impact on file system performance .Pq which can in some rare cases be even positive . -.Sh AUTHOR -.An Ivan Voras Aq ivoras@FreeBSD.org -.Pp -Sponsored by Google Summer of Code 2006. diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8 index 6e79880..ab960ff 100644 --- a/sbin/geom/core/geom.8 +++ b/sbin/geom/core/geom.8 @@ -203,4 +203,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/sbin/ggate/ggatec/ggatec.8 b/sbin/ggate/ggatec/ggatec.8 index 09f0444..72ae4c5 100644 --- a/sbin/ggate/ggatec/ggatec.8 +++ b/sbin/ggate/ggatec/ggatec.8 @@ -178,4 +178,4 @@ client# mount_cd9660 /dev/ggate0 /cdrom The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/ggate/ggated/ggated.8 b/sbin/ggate/ggated/ggated.8 index 3024a04..3560fe0 100644 --- a/sbin/ggate/ggated/ggated.8 +++ b/sbin/ggate/ggated/ggated.8 @@ -108,4 +108,4 @@ Export CD-ROM device and a file: The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/ggate/ggatel/ggatel.8 b/sbin/ggate/ggatel/ggatel.8 index 236e550..1463426 100644 --- a/sbin/ggate/ggatel/ggatel.8 +++ b/sbin/ggate/ggatel/ggatel.8 @@ -152,4 +152,4 @@ ggatel destroy -u 5 The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8 index 9d62a83..0dab89f 100644 --- a/sbin/growfs/growfs.8 +++ b/sbin/growfs/growfs.8 @@ -118,10 +118,10 @@ utility first appeared in The ability to resize mounted filesystems was added in .Fx 10.0 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .Sh CAVEATS When expanding a file system mounted read-write, any writes to that file system will be temporarily suspended until the expansion is finished. diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile index c9716e9..1b5f948 100644 --- a/sbin/gvinum/Makefile +++ b/sbin/gvinum/Makefile @@ -7,8 +7,8 @@ MAN= gvinum.8 WARNS?= 2 CFLAGS+= -I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit -DPADD= ${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} -LDADD= -ledit -ltermcap -ldevstat -lkvm -lgeom +DPADD= ${LIBEDIT} ${LIBTERMCAPW} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} +LDADD= -ledit -ltermcapw -ldevstat -lkvm -lgeom .PATH: ${.CURDIR}/../../sys/geom/vinum diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 index 703a810..a8a448c 100644 --- a/sbin/gvinum/gvinum.8 +++ b/sbin/gvinum/gvinum.8 @@ -395,9 +395,9 @@ and through the 2007 Google Summer of Code program. The documentation have been updated to reflect the new functionality. .Sh AUTHORS -.An Lukas Ertl Aq le@FreeBSD.org -.An Chris Jones Aq soc-cjones@FreeBSD.org -.An Ulf Lilleengen Aq lulf@FreeBSD.org +.An Lukas Ertl Aq Mt le@FreeBSD.org +.An Chris Jones Aq Mt soc-cjones@FreeBSD.org +.An Ulf Lilleengen Aq Mt lulf@FreeBSD.org .Sh BUGS Currently, .Nm diff --git a/sbin/hastctl/hastctl.8 b/sbin/hastctl/hastctl.8 index bdca80d..397d4cf 100644 --- a/sbin/hastctl/hastctl.8 +++ b/sbin/hastctl/hastctl.8 @@ -224,5 +224,5 @@ nodeB# application_start The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/hastd/hast.conf.5 b/sbin/hastd/hast.conf.5 index 3d921e4..c7e2e33 100644 --- a/sbin/hastd/hast.conf.5 +++ b/sbin/hastd/hast.conf.5 @@ -445,5 +445,5 @@ resource tank { The .Nm was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/hastd/hastd.8 b/sbin/hastd/hastd.8 index 68c98cb..e30a11a 100644 --- a/sbin/hastd/hastd.8 +++ b/sbin/hastd/hastd.8 @@ -228,5 +228,5 @@ nodeA# mount -o noatime /dev/hast/shared /shared The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c index b4db0f1..d2e65e4 100644 --- a/sbin/ifconfig/af_inet6.c +++ b/sbin/ifconfig/af_inet6.c @@ -42,6 +42,7 @@ static const char rcsid[] = #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <time.h> #include <ifaddrs.h> #include <arpa/inet.h> @@ -98,20 +99,21 @@ static void setip6lifetime(const char *cmd, const char *val, int s, const struct afswtch *afp) { - time_t newval, t; + struct timespec now; + time_t newval; char *ep; - t = time(NULL); + clock_gettime(CLOCK_MONOTONIC_FAST, &now); newval = (time_t)strtoul(val, &ep, 0); if (val == ep) errx(1, "invalid %s", cmd); if (afp->af_af != AF_INET6) errx(1, "%s not allowed for the AF", cmd); if (strcmp(cmd, "vltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_expire = t + newval; + in6_addreq.ifra_lifetime.ia6t_expire = now.tv_sec + newval; in6_addreq.ifra_lifetime.ia6t_vltime = newval; } else if (strcmp(cmd, "pltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_preferred = t + newval; + in6_addreq.ifra_lifetime.ia6t_preferred = now.tv_sec + newval; in6_addreq.ifra_lifetime.ia6t_pltime = newval; } } @@ -172,9 +174,11 @@ in6_status(int s __unused, const struct ifaddrs *ifa) int s6; u_int32_t flags6; struct in6_addrlifetime lifetime; - time_t t = time(NULL); + struct timespec now; int error; + clock_gettime(CLOCK_MONOTONIC_FAST, &now); + memset(&null_sin, 0, sizeof(null_sin)); sin = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -258,15 +262,15 @@ in6_status(int s __unused, const struct ifaddrs *ifa) if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) { printf("pltime "); if (lifetime.ia6t_preferred) { - printf("%s ", lifetime.ia6t_preferred < t - ? "0" : sec2str(lifetime.ia6t_preferred - t)); + printf("%s ", lifetime.ia6t_preferred < now.tv_sec + ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec)); } else printf("infty "); printf("vltime "); if (lifetime.ia6t_expire) { - printf("%s ", lifetime.ia6t_expire < t - ? "0" : sec2str(lifetime.ia6t_expire - t)); + printf("%s ", lifetime.ia6t_expire < now.tv_sec + ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec)); } else printf("infty "); } diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 290f316..5bf590d 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -679,9 +679,11 @@ Set a flag to enable Neighbor Unreachability Detection. Clear a flag .Cm nud . .It Cm no_prefer_iface -Set a flag to not prefer address on the interface as candidates of the -source address for outgoing packets, even when the interface is -outgoing interface. +Set a flag to not honor rule 5 of source address selection in RFC 3484. +In practice this means the address on the outgoing interface will not be +preferred, effectively yielding the decision to the address selection +policy table, configurable with +.Xr ip6addrctl 8 . .It Cm -no_prefer_iface Clear a flag .Cm no_prefer_iface . @@ -2333,7 +2335,6 @@ src/dst address for IPv4 or IPv6. .It Cm l4 src/dst port for TCP/UDP/SCTP. .El -.Pp .El .Pp The following parameters are specific to IP tunnel interfaces, diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index d2ddeca..1f93a0d 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -78,7 +78,7 @@ static const char rcsid[] = /* * Since "struct ifreq" is composed of various union members, callers - * should pay special attention to interprete the value. + * should pay special attention to interpret the value. * (.e.g. little/big endian difference in the structure.) */ struct ifreq ifr; diff --git a/sbin/ipf/Makefile.inc b/sbin/ipf/Makefile.inc index b3efd6f..2d7d7b1 100644 --- a/sbin/ipf/Makefile.inc +++ b/sbin/ipf/Makefile.inc @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <src.opts.mk> + WARNS?= 2 NO_WFORMAT= NO_WARRAY_BOUNDS= @@ -10,6 +12,12 @@ CFLAGS+= -I${.CURDIR}/../../../sys CFLAGS+= -I${.CURDIR}/../../../sys/contrib/ipfilter CFLAGS+= -DSTATETOP -D__UIO_EXPOSE +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DUSE_INET6 +.else +CFLAGS+= -DNOINET6 +.endif + LIBIPF= ${.OBJDIR}/../libipf/libipf.a DPADD+= ${LIBIPF} ${LIBKVM} LDADD+= ${LIBIPF} -lkvm diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index f3c31ec..9647697 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1623,7 +1623,6 @@ followed by the number of significant bits. For example, an address with 33 significant bits could be specified as: .Pp .Dl "MAC 10:20:30:40:50:60/33 any" -.Pp .It An ampersand .Pq & @@ -3611,7 +3610,7 @@ options have been added by various developer over the years. .Pp .An -nosplit In-kernel NAT support written by -.An Paolo Pisati Aq piso@FreeBSD.org +.An Paolo Pisati Aq Mt piso@FreeBSD.org as part of a Summer of Code 2005 project. .Pp SCTP diff --git a/sbin/kldconfig/kldconfig.8 b/sbin/kldconfig/kldconfig.8 index 18fbaf6..3cc288f 100644 --- a/sbin/kldconfig/kldconfig.8 +++ b/sbin/kldconfig/kldconfig.8 @@ -105,4 +105,4 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Peter Pentchev Aq roam@FreeBSD.org +.An Peter Pentchev Aq Mt roam@FreeBSD.org diff --git a/sbin/kldload/kldload.8 b/sbin/kldload/kldload.8 index ee913ed..b84b863 100644 --- a/sbin/kldload/kldload.8 +++ b/sbin/kldload/kldload.8 @@ -126,4 +126,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8 index bebabe8..b892ef6 100644 --- a/sbin/kldstat/kldstat.8 +++ b/sbin/kldstat/kldstat.8 @@ -74,4 +74,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/kldunload/kldunload.8 b/sbin/kldunload/kldunload.8 index 0a7937c..5e371e6 100644 --- a/sbin/kldunload/kldunload.8 +++ b/sbin/kldunload/kldunload.8 @@ -78,4 +78,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org diff --git a/sbin/mca/Makefile b/sbin/mca/Makefile deleted file mode 100644 index 2616725..0000000 --- a/sbin/mca/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ -PROG= mca -MAN= mca.8 - -.include <bsd.prog.mk> diff --git a/sbin/mca/mca.8 b/sbin/mca/mca.8 deleted file mode 100644 index e654d36..0000000 --- a/sbin/mca/mca.8 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 2006 Marcel Moolenaar -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd February 11, 2006 -.Dt MCA 8 -.Os -.Sh NAME -.Nm mca -.Nd "Machine Check Architecture control utility" -.Sh SYNOPSIS -.Nm -.Op Fl d -.Op Fl f Ar filename -.Sh DESCRIPTION -The -.Nm -utility provides minimal functionality to dump or display MCA records -that were saved by the kernel during boot. -The default behaviour of the -.Nm -utility is to display all new MCA records on stdout. -When the -.Fl d -option is given, the records are dumped in binary form. -The default file to which records are dumped is -.Pa /var/log/mca.log . -This can be changed by specifying the -.Fl f -option. -New records are appended to the dump file. -.Pp -Previously dumped records can be displayed by giving the name of -the dump file with the -.Fl f -option. -.Sh FILES -.Bl -tag -width ".Pa /var/log/mca.log" -compact -.It Pa /var/log/mca.log -default dump file -.El -.Sh HISTORY -The -.Nm -utility appeared in -.Fx 5.0 -for ia64. -.Sh BUGS -The development of the -.Nm -utility is still a work in progress. diff --git a/sbin/mca/mca.c b/sbin/mca/mca.c deleted file mode 100644 index ed7bcff..0000000 --- a/sbin/mca/mca.c +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright (c) 2002 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/sysctl.h> -#include <sys/uuid.h> - -/* - * Hack to make this compile on non-ia64 machines. - */ -#ifdef __ia64__ -#include <machine/mca.h> -#else -#include "../../sys/ia64/include/mca.h" -#endif - -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <uuid.h> - -#define BCD(x) ((x >> 4) * 10 + (x & 15)) - -#define HW_MCA_MAX_CPUID 255 - -static const char hw_mca_count[] = "hw.mca.count"; -static const char hw_mca_first[] = "hw.mca.first"; -static const char hw_mca_last[] = "hw.mca.last"; -static const char hw_mca_recid[] = "hw.mca.%d.%u"; - -static char default_dumpfile[] = "/var/log/mca.log"; - -int fl_dump; -char *file; - -static const char * -severity(int error) -{ - - switch (error) { - case MCA_RH_ERROR_RECOVERABLE: - return ("recoverable"); - case MCA_RH_ERROR_FATAL: - return ("fatal"); - case MCA_RH_ERROR_CORRECTED: - return ("corrected"); - } - - return ("unknown"); -} - -static const char * -uuid(uuid_t *id) -{ - static char buffer[64]; - char *s; - - uuid_to_string(id, &s, NULL); - strcpy(buffer, s); - free(s); - return (buffer); -} - -static int -show_value(int indent, const char *var, const char *fmt, ...) -{ - va_list ap; - int len; - - len = indent; - while (indent--) - putchar(' '); - len += printf("<%s>", var); - va_start(ap, fmt); - len += vprintf(fmt, ap); - len += printf("</%s>\n", var); - return (len); -} - -static size_t -show_header(struct mca_record_header *rh) -{ - - printf(" <header>\n"); - show_value(4, "seqnr", "%lld", (long long)rh->rh_seqnr); - show_value(4, "revision", "%d.%d", BCD(rh->rh_major), - BCD(rh->rh_minor)); - show_value(4, "severity", "%s", severity(rh->rh_error)); - show_value(4, "length", "%lld", (long long)rh->rh_length); - show_value(4, "date", "%d%02d/%02d/%02d", - BCD(rh->rh_time[MCA_RH_TIME_CENT]), - BCD(rh->rh_time[MCA_RH_TIME_YEAR]), - BCD(rh->rh_time[MCA_RH_TIME_MON]), - BCD(rh->rh_time[MCA_RH_TIME_MDAY])); - show_value(4, "time", "%02d:%02d:%02d", - BCD(rh->rh_time[MCA_RH_TIME_HOUR]), - BCD(rh->rh_time[MCA_RH_TIME_MIN]), - BCD(rh->rh_time[MCA_RH_TIME_SEC])); - if (rh->rh_flags & MCA_RH_FLAGS_PLATFORM_ID) - show_value(4, "platform", "%s", uuid(&rh->rh_platform)); - printf(" </header>\n"); - return (rh->rh_length); -} - -static void -show_cpu_mod(const char *what, int idx, struct mca_cpu_mod *cpu_mod) -{ - printf(" <%s-%d>\n", what, idx); - if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_INFO) - show_value(8, "info", "0x%016llx", - (long long)cpu_mod->cpu_mod_info); - if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_REQID) - show_value(8, "requester", "0x%016llx", - (long long)cpu_mod->cpu_mod_reqid); - if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_RSPID) - show_value(8, "responder", "0x%016llx", - (long long)cpu_mod->cpu_mod_rspid); - if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_TGTID) - show_value(8, "target", "0x%016llx", - (long long)cpu_mod->cpu_mod_tgtid); - if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_IP) - show_value(8, "ip", "0x%016llx", - (long long)cpu_mod->cpu_mod_ip); - printf(" </%s-%d>\n", what, idx); -} - -static void -show_cpu(struct mca_cpu_record *cpu) -{ - char var[16]; - struct mca_cpu_mod *mod; - struct mca_cpu_cpuid *cpuid; -#ifdef notyet - struct mca_cpu_psi *psi; -#endif - int i, n; - - printf(" <cpu>\n"); - - if (cpu->cpu_flags & MCA_CPU_FLAGS_ERRMAP) - show_value(6, "errmap", "0x%016llx", - (long long)cpu->cpu_errmap); - if (cpu->cpu_flags & MCA_CPU_FLAGS_STATE) - show_value(6, "state", "0x%016llx", - (long long)cpu->cpu_state); - if (cpu->cpu_flags & MCA_CPU_FLAGS_CR_LID) - show_value(6, "cr_lid", "0x%016llx", - (long long)cpu->cpu_cr_lid); - - mod = (struct mca_cpu_mod*)(cpu + 1); - n = MCA_CPU_FLAGS_CACHE(cpu->cpu_flags); - for (i = 0; i < n; i++) - show_cpu_mod("cache", i, mod++); - n = MCA_CPU_FLAGS_TLB(cpu->cpu_flags); - for (i = 0; i < n; i++) - show_cpu_mod("tlb", i, mod++); - n = MCA_CPU_FLAGS_BUS(cpu->cpu_flags); - for (i = 0; i < n; i++) - show_cpu_mod("bus", i, mod++); - n = MCA_CPU_FLAGS_REG(cpu->cpu_flags); - for (i = 0; i < n; i++) - show_cpu_mod("reg", i, mod++); - n = MCA_CPU_FLAGS_MS(cpu->cpu_flags); - for (i = 0; i < n; i++) - show_cpu_mod("ms", i, mod++); - - cpuid = (struct mca_cpu_cpuid*)mod; - for (i = 0; i < 6; i++) { - sprintf(var, "cpuid-%d", i); - show_value(6, var, "0x%016llx", (long long)cpuid->cpuid[i]); - } - -#ifdef notyet - psi = (struct mca_cpu_psi*)(cpuid + 1); -#endif - /* TODO: Dump PSI */ - - printf(" </cpu>\n"); -} - -static void -show_memory(struct mca_mem_record *mem) -{ - printf(" <memory>\n"); - - if (mem->mem_flags & MCA_MEM_FLAGS_STATUS) - show_value(6, "status", "0x%016llx", - (long long)mem->mem_status); - if (mem->mem_flags & MCA_MEM_FLAGS_ADDR) - show_value(6, "address", "0x%016llx", - (long long)mem->mem_addr); - if (mem->mem_flags & MCA_MEM_FLAGS_ADDRMASK) - show_value(6, "mask", "0x%016llx", - (long long)mem->mem_addrmask); - if (mem->mem_flags & MCA_MEM_FLAGS_NODE) - show_value(6, "node", "0x%04x", mem->mem_node); - if (mem->mem_flags & MCA_MEM_FLAGS_CARD) - show_value(6, "card", "0x%04x", mem->mem_card); - if (mem->mem_flags & MCA_MEM_FLAGS_MODULE) - show_value(6, "module", "0x%04x", mem->mem_module); - if (mem->mem_flags & MCA_MEM_FLAGS_BANK) - show_value(6, "bank", "0x%04x", mem->mem_bank); - if (mem->mem_flags & MCA_MEM_FLAGS_DEVICE) - show_value(6, "device", "0x%04x", mem->mem_device); - if (mem->mem_flags & MCA_MEM_FLAGS_ROW) - show_value(6, "row", "0x%04x", mem->mem_row); - if (mem->mem_flags & MCA_MEM_FLAGS_COLUMN) - show_value(6, "column", "0x%04x", mem->mem_column); - if (mem->mem_flags & MCA_MEM_FLAGS_BITPOS) - show_value(6, "bit", "0x%04x", mem->mem_bitpos); - if (mem->mem_flags & MCA_MEM_FLAGS_REQID) - show_value(6, "requester", "0x%016llx", - (long long)mem->mem_reqid); - if (mem->mem_flags & MCA_MEM_FLAGS_RSPID) - show_value(6, "responder", "0x%016llx", - (long long)mem->mem_rspid); - if (mem->mem_flags & MCA_MEM_FLAGS_TGTID) - show_value(6, "target", "0x%016llx", - (long long)mem->mem_tgtid); - if (mem->mem_flags & MCA_MEM_FLAGS_BUSDATA) - show_value(6, "status", "0x%016llx", - (long long)mem->mem_busdata); - if (mem->mem_flags & MCA_MEM_FLAGS_OEM_ID) - show_value(6, "oem", "%s", uuid(&mem->mem_oem_id)); - /* TODO: Dump OEM data */ - - printf(" </memory>\n"); -} - -static void -show_sel(void) -{ - printf(" # SEL\n"); -} - -static void -show_pci_bus(struct mca_pcibus_record *pcibus) -{ - printf(" <pci-bus>\n"); - - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_STATUS) - show_value(6, "status", "0x%016llx", - (long long)pcibus->pcibus_status); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_ERROR) - show_value(6, "error", "0x%04x", pcibus->pcibus_error); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_BUS) - show_value(6, "bus", "0x%04x", pcibus->pcibus_bus); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_ADDR) - show_value(6, "address", "0x%016llx", - (long long)pcibus->pcibus_addr); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_DATA) - show_value(6, "data", "0x%016llx", - (long long)pcibus->pcibus_data); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_CMD) - show_value(6, "cmd", "0x%016llx", - (long long)pcibus->pcibus_cmd); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_REQID) - show_value(6, "requester", "0x%016llx", - (long long)pcibus->pcibus_reqid); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_RSPID) - show_value(6, "responder", "0x%016llx", - (long long)pcibus->pcibus_rspid); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_TGTID) - show_value(6, "target", "0x%016llx", - (long long)pcibus->pcibus_tgtid); - if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_OEM_ID) - show_value(6, "oem", "%s", uuid(&pcibus->pcibus_oem_id)); - /* TODO: Dump OEM data */ - - printf(" </pci-bus>\n"); -} - -static void -show_smbios(void) -{ - printf(" # SMBIOS\n"); -} - -static void -show_pci_dev(struct mca_pcidev_record *pcidev) -{ - printf(" <pci-dev>\n"); - - if (pcidev->pcidev_flags & MCA_PCIDEV_FLAGS_STATUS) - show_value(6, "status", "0x%016llx", - (long long)pcidev->pcidev_status); - if (pcidev->pcidev_flags & MCA_PCIDEV_FLAGS_INFO) { - show_value(6, "vendor", "0x%04x", - pcidev->pcidev_info.info_vendor); - show_value(6, "device", "0x%04x", - pcidev->pcidev_info.info_device); - show_value(6, "class", "0x%06x", - MCA_PCIDEV_INFO_CLASS(pcidev->pcidev_info.info_ccfn)); - show_value(6, "function", "0x%02x", - MCA_PCIDEV_INFO_FUNCTION(pcidev->pcidev_info.info_ccfn)); - show_value(6, "slot", "0x%02x", pcidev->pcidev_info.info_slot); - show_value(6, "bus", "0x%04x", pcidev->pcidev_info.info_bus); - show_value(6, "segment", "0x%04x", - pcidev->pcidev_info.info_segment); - } - /* TODO: dump registers */ - /* TODO: Dump OEM data */ - - printf(" </pci-dev>\n"); -} - -static void -show_generic(void) -{ - printf(" # GENERIC\n"); -} - -static size_t -show_section(struct mca_section_header *sh) -{ - static uuid_t uuid_cpu = MCA_UUID_CPU; - static uuid_t uuid_memory = MCA_UUID_MEMORY; - static uuid_t uuid_sel = MCA_UUID_SEL; - static uuid_t uuid_pci_bus = MCA_UUID_PCI_BUS; - static uuid_t uuid_smbios = MCA_UUID_SMBIOS; - static uuid_t uuid_pci_dev = MCA_UUID_PCI_DEV; - static uuid_t uuid_generic = MCA_UUID_GENERIC; - - printf(" <section>\n"); - show_value(4, "uuid", "%s", uuid(&sh->sh_uuid)); - show_value(4, "revision", "%d.%d", BCD(sh->sh_major), - BCD(sh->sh_minor)); - - if (uuid_equal(&sh->sh_uuid, &uuid_cpu, NULL)) - show_cpu((void*)(sh + 1)); - else if (uuid_equal(&sh->sh_uuid, &uuid_memory, NULL)) - show_memory((void*)(sh + 1)); - else if (uuid_equal(&sh->sh_uuid, &uuid_sel, NULL)) - show_sel(); - else if (uuid_equal(&sh->sh_uuid, &uuid_pci_bus, NULL)) - show_pci_bus((void*)(sh + 1)); - else if (uuid_equal(&sh->sh_uuid, &uuid_smbios, NULL)) - show_smbios(); - else if (uuid_equal(&sh->sh_uuid, &uuid_pci_dev, NULL)) - show_pci_dev((void*)(sh + 1)); - else if (uuid_equal(&sh->sh_uuid, &uuid_generic, NULL)) - show_generic(); - - printf(" </section>\n"); - return (sh->sh_length); -} - -static void -show(char *data, const char *mib) -{ - size_t reclen, seclen; - - if (mib != NULL) - printf("<!-- MIB: %s -->\n", mib); - - printf("<record>\n"); - reclen = show_header((void*)data) - sizeof(struct mca_record_header); - data += sizeof(struct mca_record_header); - while (reclen > sizeof(struct mca_section_header)) { - seclen = show_section((void*)data); - reclen -= seclen; - data += seclen; - } - printf("</record>\n"); -} - -static void -showall(char *buf, size_t buflen) -{ - struct mca_record_header *rh; - size_t reclen; - - do { - if (buflen < sizeof(struct mca_record_header)) - return; - - rh = (void*)buf; - reclen = rh->rh_length; - if (buflen < reclen) - return; - - show(buf, NULL); - - buf += reclen; - buflen -= reclen; - } - while (1); -} - -static void -dump(char *data) -{ - struct mca_record_header *rh; - const char *fn; - int fd; - - rh = (void*)data; - fn = (file) ? file : default_dumpfile; - fd = open(fn, O_WRONLY|O_CREAT|O_APPEND, 0660); - if (fd == -1) - err(2, "open(%s)", fn); - if (write(fd, (void*)rh, rh->rh_length) == -1) - err(2, "write(%s)", fn); - close(fd); -} - -static void -usage(void) -{ - - fprintf(stderr, "usage: mca [-df]\n"); - exit (1); -} - -int -main(int argc, char **argv) -{ - char mib[32]; - char *buf; - size_t len; - int ch, error, fd; - int count, first, last, cpuid; - - while ((ch = getopt(argc, argv, "df:")) != -1) { - switch(ch) { - case 'd': /* dump */ - fl_dump = 1; - break; - case 'f': - if (file) - free(file); /* XXX complain! */ - file = strdup(optarg); - break; - default: - usage(); - } - } - - argc -= optind; - argv += optind; - - if (file == NULL || fl_dump) { - len = sizeof(count); - if (sysctlbyname(hw_mca_count, &count, &len, NULL, 0) == -1) - err(1, hw_mca_count); - - if (count == 0) - errx(0, "no error records found"); - - len = sizeof(first); - if (sysctlbyname(hw_mca_first, &first, &len, NULL, 0) == -1) - err(1, hw_mca_first); - - len = sizeof(last); - if (sysctlbyname(hw_mca_last, &last, &len, NULL, 0) == -1) - err(1, hw_mca_last); - - cpuid = 0; - error = 0; - while (count && first <= last) { - do { - sprintf(mib, hw_mca_recid, first, cpuid); - len = 0; - ch = sysctlbyname(mib, NULL, &len, NULL, 0); - error = (ch == -1) ? errno : 0; - if (error != ENOENT) - break; - cpuid++; - } while (cpuid <= HW_MCA_MAX_CPUID); - if (error == ENOENT && cpuid > HW_MCA_MAX_CPUID) { - first++; - cpuid = 0; - continue; - } - if (error) - errc(1, error, "%s(1)", mib); - - buf = malloc(len); - if (buf == NULL) - err(1, "buffer"); - - if (sysctlbyname(mib, buf, &len, NULL, 0) == -1) - err(1, "%s(2)", mib); - - if (fl_dump) - dump(buf); - else - show(buf, mib); - - free(buf); - count--; - if (cpuid == HW_MCA_MAX_CPUID) { - first++; - cpuid = 0; - } else - cpuid++; - } - } else { - fd = open(file, O_RDONLY); - if (fd == -1) - err(1, "open(%s)", file); - - len = lseek(fd, 0LL, SEEK_END); - buf = mmap(NULL, len, PROT_READ, 0U, fd, 0LL); - if (buf == MAP_FAILED) - err(1, "mmap(%s)", file); - - showall(buf, len); - - munmap(buf, len); - close(fd); - } - - return (0); -} diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index 77c40a1..e191cd1 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -154,4 +154,4 @@ This program is placed in the public domain for free general use by RSA Data Security. .Pp Support for SHA-1 and RIPEMD-160 has been added by -.An Oliver Eikemeier Aq eik@FreeBSD.org . +.An Oliver Eikemeier Aq Mt eik@FreeBSD.org . diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 6b52bec..04d3391 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -319,5 +319,4 @@ combo. The .Nm utility was written by -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index 50c5a8b..3b5c254 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -551,6 +551,7 @@ support for a particular file system might be provided either on a static .Xr mount_smbfs 8 , .Xr mount_udf 8 , .Xr mount_unionfs 8 , +.Xr tmpfs 5 , .Xr umount 8 , .Xr zfs 8 , .Xr zpool 8 diff --git a/sbin/mount/mount.conf.8 b/sbin/mount/mount.conf.8 index c3296c3..45b8257 100644 --- a/sbin/mount/mount.conf.8 +++ b/sbin/mount/mount.conf.8 @@ -247,6 +247,6 @@ The root mount logic in the kernel which parses .Pa /.mount.conf was written by -.An Marcel Moolenaar Aq marcel@FreeBSD.org . +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . This man page was written by -.An Craig Rodrigues Aq rodrigc@FreeBSD.org . +.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . diff --git a/sbin/mount_cd9660/mount_cd9660.8 b/sbin/mount_cd9660/mount_cd9660.8 index b471686..974ab3b 100644 --- a/sbin/mount_cd9660/mount_cd9660.8 +++ b/sbin/mount_cd9660/mount_cd9660.8 @@ -147,7 +147,7 @@ utility first appeared in .Bx 4.4 . .Pp The Unicode conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org +.An Ryuichiro Imura Aq Mt imura@ryu16.org in 2003. .Sh BUGS POSIX device node mapping is currently not supported. diff --git a/sbin/mount_fusefs/mount_fusefs.8 b/sbin/mount_fusefs/mount_fusefs.8 index 7c8bb67..3e11cf1 100644 --- a/sbin/mount_fusefs/mount_fusefs.8 +++ b/sbin/mount_fusefs/mount_fusefs.8 @@ -151,7 +151,6 @@ Do not refuse unmounting if there are secondary mounts .It Cm push_symlinks_in Prefix absolute symlinks with the mountpoint .El -.Pp .El .Pp Besides the above mount options, there is a set of pseudo-mount options which diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8 index e7bc764..ae69aeb 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.8 +++ b/sbin/mount_msdosfs/mount_msdosfs.8 @@ -213,8 +213,8 @@ of the more aptly-named .Nm . .Pp The character code conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org -at 2003. +.An Ryuichiro Imura Aq Mt imura@ryu16.org +in 2003. .Sh CAVEATS The use of the .Fl 9 diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index da11c29..124ba7d 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd December 7, 2013 +.Dd August 5, 2014 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -371,6 +371,14 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm vers Ns = Ns Aq Ar vers_number +Use the specified version number for NFS requests. +See the +.Cm nfsv2 , +.Cm nfsv3 , +and +.Cm nfsv4 +options for details. .It Cm wcommitsize Ns = Ns Aq Ar value Set the maximum pending write commit size to the specified value. This determines the maximum amount of pending write data that the NFS @@ -466,6 +474,26 @@ Same as Same as .Fl o Cm retrans Ns = Ns Aq Ar value .El +.Pp +The following +.Fl o +named options are equivalent to other +.Fl o +named options and are supported for compatibility with other +operating systems (e.g., Linux, Solaris, and OSX) to ease usage of +.Xr autofs 5 +support. +.Bl -tag -width indent +.It Fl o Cm vers Ns = Ns 2 +Same as +.Fl o Cm nfsv2 +.It Fl o Cm vers Ns = Ns 3 +Same as +.Fl o Cm nfsv3 +.It Fl o Cm vers Ns = Ns 4 +Same as +.Fl o Cm nfsv4 +.El .Sh SEE ALSO .Xr nmount 2 , .Xr unmount 2 , diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index bd016f3..383f475 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -310,6 +310,32 @@ main(int argc, char *argv[]) if (*p || num <= 0) errx(1, "illegal maxgroups value -- %s", val); //set_rpc_maxgrouplist(num); + } else if (strcmp(opt, "vers") == 0) { + num = strtol(val, &p, 10); + if (*p || num <= 0) + errx(1, "illegal vers value -- " + "%s", val); + switch (num) { + case 2: + mountmode = V2; + break; + case 3: + mountmode = V3; + build_iovec(&iov, &iovlen, + "nfsv3", NULL, 0); + break; + case 4: + mountmode = V4; + fstype = "nfs"; + nfsproto = IPPROTO_TCP; + if (portspec == NULL) + portspec = "2049"; + break; + default: + errx(1, "illegal nfs version " + "value -- %s", val); + } + pass_flag_to_nmount=0; } if (pass_flag_to_nmount) build_iovec(&iov, &iovlen, opt, val, diff --git a/sbin/mount_unionfs/mount_unionfs.8 b/sbin/mount_unionfs/mount_unionfs.8 index b613a94..075eff1 100644 --- a/sbin/mount_unionfs/mount_unionfs.8 +++ b/sbin/mount_unionfs/mount_unionfs.8 @@ -342,9 +342,9 @@ because this is identical to using .An -nosplit In .Fx 7.0 , -.An Masanori OZAWA Aq ozawa@ongs.co.jp +.An Masanori OZAWA Aq Mt ozawa@ongs.co.jp reimplemented handling of locking, whiteout, and file mode bits, and -.An Hiroki Sato Aq hrs@FreeBSD.org +.An Hiroki Sato Aq Mt hrs@FreeBSD.org wrote about the changes in this manual page. .Sh BUGS THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK) @@ -357,7 +357,7 @@ BATTERIES NOT INCLUDED. .Pp This code also needs an owner in order to be less dangerous - serious hackers can apply by sending mail to -.Aq freebsd-fs@FreeBSD.org +.Aq Mt freebsd-fs@FreeBSD.org and announcing their intent to take it over. .Pp diff --git a/sbin/natd/natd.8 b/sbin/natd/natd.8 index b4b37ed..7ccfbf7 100644 --- a/sbin/natd/natd.8 +++ b/sbin/natd/natd.8 @@ -585,7 +585,6 @@ in the file or using the command .Pp .Dl "sysctl net.inet.ip.forwarding=1" -.Pp .It If you use the .Fl interface @@ -813,19 +812,19 @@ are forwarded to the appropriate router on that interface. This program is the result of the efforts of many people at different times: .Pp -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org (divert sockets) -.An Charles Mott Aq cm@linktel.net +.An Charles Mott Aq Mt cm@linktel.net (packet aliasing) -.An Eivind Eklund Aq perhaps@yes.no +.An Eivind Eklund Aq Mt perhaps@yes.no (IRC support & misc additions) -.An Ari Suutari Aq suutari@iki.fi +.An Ari Suutari Aq Mt suutari@iki.fi (natd) -.An Dru Nelson Aq dnelson@redwoodsoft.com +.An Dru Nelson Aq Mt dnelson@redwoodsoft.com (early PPTP support) -.An Brian Somers Aq brian@awfulhak.org +.An Brian Somers Aq Mt brian@awfulhak.org (glue) -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org (natd, packet aliasing, glue) -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org (multiple instances) diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8 index 1627f2d..d61043a 100644 --- a/sbin/newfs_msdos/newfs_msdos.8 +++ b/sbin/newfs_msdos/newfs_msdos.8 @@ -238,4 +238,4 @@ The utility first appeared in .Fx 3.0 . .Sh AUTHORS -.An Robert Nordier Aq rnordier@FreeBSD.org . +.An Robert Nordier Aq Mt rnordier@FreeBSD.org diff --git a/sbin/newfs_nandfs/newfs_nandfs.8 b/sbin/newfs_nandfs/newfs_nandfs.8 index 6997430..7a630bb 100644 --- a/sbin/newfs_nandfs/newfs_nandfs.8 +++ b/sbin/newfs_nandfs/newfs_nandfs.8 @@ -72,5 +72,5 @@ The .Nm utility first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS .An Grzegorz Bernacki diff --git a/sbin/nos-tun/nos-tun.8 b/sbin/nos-tun/nos-tun.8 index 405d430..8ea6d5c 100644 --- a/sbin/nos-tun/nos-tun.8 +++ b/sbin/nos-tun/nos-tun.8 @@ -82,11 +82,11 @@ tunnel source 192.168.56.45 .Ed .Sh AUTHORS .An -nosplit -.An Nickolay N. Dudorov Aq nnd@itfs.nsk.su +.An Nickolay N. Dudorov Aq Mt nnd@itfs.nsk.su wrote the program, -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org wrote the man-page. -.An Isao SEKI Aq iseki@gongon.com +.An Isao SEKI Aq Mt iseki@gongon.com added a new flag, IP protocol number. .Sh BUGS We do not allow for setting our source address for multihomed machines. diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 010f106..3b4b5c2 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -124,7 +124,7 @@ nvme0 controller and activate it on the next reset. .An -nosplit .Nm was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 5c0e7b3..5908cf1 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -317,7 +317,6 @@ To kill a state with ID 4823e84500000018 created from a backup firewall with hostid 00000002 use: .Pp .Dl # pfctl -k id -k 4823e84500000018/2 -.Pp .It Fl m Merge in explicitly given options without resetting those which are omitted. diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 01e29a1..b963de1 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1090,8 +1090,14 @@ main(int argc, char *argv[]) /* signal handling */ if (seenalrm) { /* last packet sent, timeout reached? */ - if (npackets && ntransmitted >= npackets) - break; + if (npackets && ntransmitted >= npackets) { + struct timeval zerotime = {0, 0}; + itimer.it_value = zerotime; + itimer.it_interval = zerotime; + (void)setitimer(ITIMER_REAL, &itimer, NULL); + seenalrm = 0; /* clear flag */ + continue; + } retransmit(); seenalrm = 0; continue; diff --git a/sbin/rcorder/rcorder.8 b/sbin/rcorder/rcorder.8 index b43383a..995ef68 100644 --- a/sbin/rcorder/rcorder.8 +++ b/sbin/rcorder/rcorder.8 @@ -165,9 +165,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit Written by -.An Perry E. Metzger Aq perry@piermont.com +.An Perry E. Metzger Aq Mt perry@piermont.com and -.An Matthew R. Green Aq mrg@eterna.com.au . +.An Matthew R. Green Aq Mt mrg@eterna.com.au . .Sh BUGS The .Dq Li REQUIRE diff --git a/sbin/reboot/nextboot.8 b/sbin/reboot/nextboot.8 index eb38319..7d41352 100644 --- a/sbin/reboot/nextboot.8 +++ b/sbin/reboot/nextboot.8 @@ -118,7 +118,7 @@ appeared in .Fx 5.0 . .Sh AUTHORS This manual page was written by -.An Gordon Tetlow Aq gordon@FreeBSD.org . +.An Gordon Tetlow Aq Mt gordon@FreeBSD.org . .Sh BUGS The .Nm diff --git a/sbin/recoverdisk/recoverdisk.1 b/sbin/recoverdisk/recoverdisk.1 index b3924c5..fd42f65 100644 --- a/sbin/recoverdisk/recoverdisk.1 +++ b/sbin/recoverdisk/recoverdisk.1 @@ -137,9 +137,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit The original implementation was done by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org with minor improvements from -.An Ulrich Sp\(:orlein Aq uqs@FreeBSD.org . +.An Ulrich Sp\(:orlein Aq Mt uqs@FreeBSD.org . .Pp This manual page was written by .An Ulrich Sp\(:orlein . diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 4f34549..225fe32 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -260,9 +260,11 @@ setup(void) fssize = TP_BSIZE; if (stbuf.st_blksize >= TP_BSIZE && stbuf.st_blksize <= MAXBSIZE) fssize = stbuf.st_blksize; - if (((fssize - 1) & fssize) != 0) { - fprintf(stderr, "bad block size %ld\n", fssize); - done(1); + if (((TP_BSIZE - 1) & stbuf.st_blksize) != 0) { + fprintf(stderr, "Warning: filesystem with non-multiple-of-%d " + "blocksize (%d);\n", TP_BSIZE, stbuf.st_blksize); + fssize = roundup(fssize, TP_BSIZE); + fprintf(stderr, "\twriting using blocksize %ld\n", fssize); } if (spcl.c_volume != 1) { fprintf(stderr, "Tape is not volume 1 of the dump\n"); diff --git a/sbin/sconfig/sconfig.8 b/sbin/sconfig/sconfig.8 index 3fe7abc..aa52b64 100644 --- a/sbin/sconfig/sconfig.8 +++ b/sbin/sconfig/sconfig.8 @@ -595,7 +595,7 @@ versions of the utility are not fully compatible. .\"-------------------------------------------------------------- .Sh AUTHORS -.An Cronyx Engineering Aq info@cronyx.ru +.An Cronyx Engineering Aq Mt info@cronyx.ru .Pp .Pa http://www.cronyx.ru .\"-------------------------------------------------------------- diff --git a/sbin/setkey/setkey.8 b/sbin/setkey/setkey.8 index 19a9164..4306ec2 100644 --- a/sbin/setkey/setkey.8 +++ b/sbin/setkey/setkey.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 13, 2006 +.Dd July 25, 2014 .Dt SETKEY 8 .Os .\" @@ -514,7 +514,7 @@ the SA from the key exchange daemon. A value of .Li default tells the kernel to use the system wide default protocol -e.g.\& the one from the +e.g.,\& the one from the .Li esp_trans_deflev sysctl variable, when the kernel processes the packet. A value of @@ -627,7 +627,7 @@ des-deriv 64 ipsec-ciph-des-derived-01 3des-deriv 192 no document rijndael-cbc 128/192/256 rfc3602 aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03 -camllia-cbc 128/192/256 rfc4312 +camellia-cbc 128/192/256 rfc4312 .Ed .Pp Note that the first 128/192/256 bits of a key for @@ -656,47 +656,46 @@ des-cbc encryption algorithm. .Bd -literal -offset indent add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457 -E des-cbc 0x3ffe05014819ffff ; - +.Pp .Ed .\" Add an authentication SA between two FQDN specified hosts: .Bd -literal -offset indent add -6 myhost.example.com yourhost.example.com ah 123456 -A hmac-sha1 "AH SA configuration!" ; - +.Pp .Ed Use both ESP and AH between two numerically specified hosts: .Bd -literal -offset indent add 10.0.11.41 10.0.11.33 esp 0x10001 -E des-cbc 0x3ffe05014819ffff -A hmac-md5 "authentication!!" ; - +.Pp .Ed Get the SA information associated with first example above: .Bd -literal -offset indent get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ; - +.Pp .Ed Flush all entries from the database: .Bd -literal -offset indent flush ; - +.Pp .Ed Dump the ESP entries from the database: .Bd -literal -offset indent dump esp ; - +.Pp .Ed Add a security policy between two networks that uses ESP in tunnel mode: .Bd -literal -offset indent spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ; - +.Pp .Ed Use TCP MD5 between two numerically specified hosts: .Bd -literal -offset indent add 10.1.10.34 10.1.10.36 tcp 0x1000 -A tcp-md5 "TCP-MD5 BGP secret" ; - .Ed .\" .Sh SEE ALSO diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index a86d659..1359645 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -710,9 +710,10 @@ show_var(int *oid, int nlen) warnx("malloc failed"); return (1); } + ctltype = (kind & CTLTYPE); len = j; i = sysctl(oid, nlen, val, &len, 0, 0); - if (i || !len) { + if (i != 0 || (len == 0 && ctltype != CTLTYPE_STRING)) { free(oval); return (1); } @@ -724,7 +725,6 @@ show_var(int *oid, int nlen) } val[len] = '\0'; p = val; - ctltype = (kind & CTLTYPE); sign = ctl_sign[ctltype]; intlen = ctl_size[ctltype]; |