commit - d439592012f7858a81ef1e384713128905908e10
commit + 4282096ce0a55f2acaff2df0813c066751158cb7
blob - b299d8095dc3200663393237ba52811d06204a5d
blob + d3c7a2e25bd1707f0b4cdffecf31a4a7c8d5538d
--- commands.c
+++ commands.c
static int flush_history(void);
static int is_bad_input(const char *, size_t);
static int read_command_line(EditLine *, History *);
+static int int_logger(char *, int, int, char **);
static int int_ping(char *, int, int, char **);
static int int_ping6(char *, int, int, char **);
static int int_traceroute(char *, int, int, char **);
static int int_help(void);
static int int_exit(void);
static int hostname(int, char **);
+static int logger(int, char **);
static int manual(int, char**);
static int nocmd(int, char **);
static int docmd(int, char **);
*/
static char pinghelp[];
+static char loggerhelp[];
static char ping6help[];
static char tracerthelp[];
static char tracert6help[];
{ "traceroute6", tracert6help, CMPL0 0, 0, int_traceroute6, 0 },
{ "ssh", sshhelp, CMPL0 0, 0, int_ssh, 0 },
{ "telnet", telnethelp, CMPL0 0, 0, int_telnet, 0 },
+ { "logger", loggerhelp, CMPL0 0, 0, int_logger, 0 },
{ "do", dohelp, CMPL(c) 0, 0, int_do, 0 },
{ "setenv", setenvhelp, CMPL(e) 0, 0, int_setenv, 0 },
{ "unsetenv", unsetenvhelp, CMPL(e) 0, 0, int_unsetenv, 0 },
{ "traceroute6", tracert6help, CMPL0 0, 0, int_traceroute6, 0 },
{ "ssh", sshhelp, CMPL0 0, 0, int_ssh, 0 },
{ "telnet", telnethelp, CMPL0 0, 0, int_telnet, 0 },
+ { "logger", loggerhelp, CMPL0 0, 0, int_logger, 0 },
{ "do", dohelp, CMPL(c) 0, 0, int_do, 0 },
{ "setenv", setenvhelp, CMPL(e) 0, 0, int_setenv, 0 },
{ "unsetenv", unsetenvhelp, CMPL(e) 0, 0, int_unsetenv, 0 },
strlcpy(next_ifname, new_ifname, sizeof(next_ifname));
return 0; /* do not leave interface context */
+}
+
+static int
+int_logger(char *ifname, int ifs, int argc, char **argv)
+{
+ logger(argc, argv);
+ return 0; /* do not leave interface context */
}
+
static int
int_ping(char *ifname, int ifs, int argc, char **argv)
{
verbosehelp[] = "Set verbose diagnostics",
editinghelp[] = "Set command line editing",
confighelp[] = "Set configuration mode",
+ loggerhelp[] = "Write a message to syslog on the system",
whohelp[] = "Display system users",
dohelp[] = "Superfluous, do is ignored and its arguments executed",
setenvhelp[] = "Set an environment variable",
{ "ssh", sshhelp, CMPL0 0, 0, ssh, 0, 0, 0, 0 },
{ "telnet", telnethelp, CMPL0 0, 0, telnet, 0, 0, 0, 0 },
{ "reboot", nreboothelp, CMPL0 0, 0, nreboot, 1, 0, 0, 0 },
+ { "logger", loggerhelp, CMPL0 0, 0, logger, 0, 0, 0, 0 },
{ "halt", halthelp, CMPL0 0, 0, halt, 1, 0, 0, 0 },
{ "powerdown", powerdownhelp, CMPL0 0, 0, powerdown, 1, 0, 0, 0 },
{ "write-config", savehelp, CMPL0 0, 0, wr_startup, 1, 0, 0, 0 },
return 0;
}
+/* logger command */
+
+
+int
+logger(int argc, char *argv[])
+{
+ if (argc < 2) {
+ printf("%% Invalid arguments\n");
+ return 1;
+ } else {
+ cmdargs(LOGGER, argv);
+ }
+ return 0;
+}
+
+
/*
* "no" command
* This is a pseudo command table entry used for TAB-completion purposes.
blob - e56534fea6e9c18e5ce36a0801be214dcae3f482
blob + 97a5efd074846dac2909aadaa8f91bcd97f45152
--- externs.h
+++ externs.h
#define NSHRC_TEMP "/var/run/nshrc"
#define NSHRC "/etc/nshrc"
#define CLEAR "/usr/bin/clear"
+#define LOGGER "/usr/bin/logger"
#define PING "/sbin/ping"
#define PING6 "/sbin/ping6"
#define TRACERT "/usr/sbin/traceroute"
blob - d4b88307bebb7442712e090ea069993ae63c2062
blob + 99dbfbeef9c1b4a46c9c4b8f92ec92d5b98bcf5b
--- nsh.8
+++ nsh.8
E.g show all available valid commands with double tab key sequence <tab><tab>
.Bd -literal -offset indent
nsh(config-p)/
-! disable halt ldap ospf relay smtp verbose
-? do help ldp ospf6 resolv snmp who
-arp dvmrp hostname manual pf rip ssh write-config
-bgp editing ifstate motd ping route sshd
-bridge eigrp ike mpls ping6 rtable telnet
-clear enable inet nameserver pipex sasync tftp
-configure exit interface ndp powerdown saveenv tftp-proxy
-crontab flush ip no quit scheduler traceroute
-ddb ftp-proxy ip6 nppp rad setenv traceroute6
-dhcp group ipsec ntp reboot show unsetenv
+! enable ldap ping6 show
+? exit ldp pipex smtp
+arp flush logger powerdown snmp
+bgp ftp-proxy manual quit ssh
+bridge group motd rad sshd
+clear halt mpls reboot telnet
+configure help nameserver relay tftp
+crontab hostname ndp resolv tftp-proxy
+ddb ifstate no rip traceroute
+dhcp ike nppp route traceroute6
+disable inet ntp rtable unsetenv
+do interface ospf sasync verbose
+dvmrp ip ospf6 saveenv who
+editing ip6 pf scheduler write-config
+eigrp ipsec ping setenv
nsh(config-p)/
.Ed
If what is typed is ambiguous double tab presents the administrator
% Commands may be abbreviated.
% Commands are:
- hostname Set system hostname
- interface Modify interface parameters
rtable Routing table switch
- group Modify group attributes
- arp Static ARP set
- ndp Static NDP set
- nameserver set or remove static DNS nameservers
- bridge Modify bridge parameters
show Show system information
- ip Set IP networking parameters
- ip6 Set IPv6 networking parameters
- mpls Set MPLS network parameters
- ddb Set DDB parameters
- pipex Set PIPEX parameters
flush Flush system tables
enable Enable privileged mode
clear Clear the terminal screen
disable Disable privileged mode
- route Add a host or network route
- pf Packet filter control
- ospf OSPF control
- ospf6 OSPF6 control
- eigrp EIGRP control
- bgp BGP control
- rip RIP control
- ldp LDP control
- relay Relay control
- ipsec IPsec IKEv1 control
- ike IPsec IKEv2 control
- dvmrp DVMRP control
- rad Router advertisement control
- sasync SA synchronization control
- dhcp DHCP server control
- snmp SNMP server control
- ldap LDAP server control
- smtp SMTP server control
- sshd SSH server control
- ntp NTP synchronization control
- nppp PPP server control
- ifstate ifstate server control
- ftp-proxy ftp-proxy server control
- tftp-proxy tftp-proxy server control
- tftp TFTP server control
- resolv Resolver configuration control
- motd Message of-the-day
- inet Inet super-server control
ping Send IPv4 ICMP echo request
ping6 Send IPv6 ICMP echo request
traceroute Print the route to IPv4 host
ssh SSH connection to remote host
telnet Telnet connection to remote host
reboot Reboot the system
+ logger Write a message to syslog on the system
halt Halt the system
powerdown Power the system down
write-config Save the current configuration
verbose Set verbose diagnostics
editing Set command line editing
+ configure Set configuration mode
who Display system users
+ do Superfluous, do is ignored and its arguments executed
+ setenv Set an environment variable
+ unsetenv Delete an environment variable
+ saveenv Save environment variables set by setenv to ~/.nshenv
! Invoke a subshell or run an executable
? Print help information
+ manual Display the NSH manual
+ exit Leave configuration mode and return to privileged mode
quit Close current connection
nsh(p)/
.Ed
traceroute6 Print the route to IPv6 host
ssh SSH connection to remote host
telnet Telnet connection to remote host
+ logger Write a message to syslog on the system
+ do Superfluous, do is ignored and its arguments executed
+ setenv Set an environment variable
+ unsetenv Delete an environment variable
+ saveenv Save environment variables set by setenv to ~/.nshenv
rule Bridge layer 2 filtering rules
static Static bridge address entry
ifpriority Spanning priority of a member on an 802.1D bridge
parent Parent interface
tunneldomain Tunnel parameters
protect Configure protected bridge domains
+ interface Modify interface parameters
shutdown Shutdown bridge
show Show system information
who Display system users
command is an alias for the
.Cm crontab
command described above.
+.Pp
+.Tg logger
+.Tg syslog
+.Tg log
+.Tg message
+.Ic logger
+.Ar log message
+.Pp
+The logger command allows the user to enter arbitary messages into
+the system log.
+It can be useful to mark external events of note for diagnostics
+and context in analysis later on.
+See
+.Xr logger 1
+for more information.
+.Bl -dash
+.It
+E.g recording a power outage in the log for future reference.
+.Bd -literal -offset indent
+nsh(config-p)/logger power failure in facility
+nsh(config-p)/logger interface drops due to unprotected devices
+nsh(config-p)/!tail /var/log/messages
+Sep 8 13:03:30 tobsd /bsd: scsibus2 at vscsi0: 256 targets
+Sep 8 13:03:30 tobsd /bsd: softraid0 at root
+Sep 8 13:03:30 tobsd /bsd: scsibus3 at softraid0: 256 targets
+Sep 8 13:03:30 tobsd /bsd: root on sd0a (619d721c1c3c871d.a) swap on sd0b dump on sd0b
+Sep 8 13:03:30 tobsd savecore: /dev/sd0b: Device busy
+Sep 8 13:03:55 tobsd reorder_kernel: kernel relinking done
+Sep 8 15:05:06 tobsd tom: power failure in facility
+Sep 8 15:05:37 tobsd tom: interface drops due to unprotected devices
+.Ed
+.El
.Pp
.Tg reboot
.Ic reboot
% Interface configuration commands are:
inet IPv4/IPv6 addresses
- ip Alias for the "inet" command
+ ip Alias for "inet" command
autoconf4 IPv4 Autoconfigurable address (DHCP)
description Interface description
group Interface group
traceroute6 Print the route to IPv6 host
ssh SSH connection to remote host
telnet Telnet connection to remote host
+ logger Write a message to syslog on the system
+ do Superfluous, do is ignored and its arguments executed
+ setenv Set an environment variable
+ unsetenv Delete an environment variable
+ saveenv Save environment variables set by setenv to ~/.nshenv
keepalive GRE tunnel keepalive
mplslabel MPLS local label
pwe MPLS PWE3
wgrtable Wireguard routing table
trunkport Add child interface(s) to trunk
trunkproto Define trunkproto
+ apn Access Point Name
+ setpin Set SIM card PIN
+ setpuk Set new SIM card PIN using PUK for validation
+ chgpin Permanently change SIM PIN
+ class Preferred cell classes
+ roaming Enable data roaming
+ interface Modify interface parameters
shutdown Shutdown interface
show Show system information
who Display system users
? Options
manual Display the NSH manual
exit Leave interface config mode and return to global config mode
- ? Options
.Ed
.Pp
.Op no