Add interfaces flags, extend ifconfig, add ifup and ifdown commands (Darcy Gong
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5308 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
34344abd32
commit
73659bfd99
|
@ -3564,4 +3564,6 @@
|
|||
* RGMP 4.0 updated from Qiany Yu.
|
||||
* configs/*/Make.defs and configs/*/ld.script: Massive clean-up
|
||||
and standardization of linker scripts from Freddie Chopin.
|
||||
* net/netdev_ioctl.c: Add interface state flags and ioctl calls
|
||||
to bring network interfaces up and down (from Darcy Gong).
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
|
||||
<p>Last Updated: October 31, 2012</p>
|
||||
<p>Last Updated: November 4, 2012</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -173,175 +173,187 @@
|
|||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdifconfig">2.16 Show Network Configuration (ifconfig)</a>
|
||||
<a href="#cmdifconfig">2.16 Manage Network Configuration (ifconfig)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdkill">2.17 Send a signal to a task (kill)</a>
|
||||
<a href="#cmdifdown">2.17 Take a network down (ifdown)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdlosetup">2.18 Setup/teardown the Loop Device (losetup)</a>
|
||||
<a href="#cmdifup">2.18 Bring a network up (ifup)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdls">2.19 List Directory Contents (ls)</a>
|
||||
<a href="#cmdkill">2.19 Send a signal to a task (kill)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmd5">2.20 Calculate MD5 (md5)</a>
|
||||
<a href="#cmdlosetup">2.20 Setup/teardown the Loop Device (losetup)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmbhw">2.21 Access Memory (mb, mh, and mw)</a>
|
||||
<a href="#cmdls">2.21 List Directory Contents (ls)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdps">2.22 Show Current Tasks and Threads (ps)</a>
|
||||
<a href="#cmdmd5">2.22 Calculate MD5 (md5)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmkdir">2.23 Create a Directory (mkdir)</a>
|
||||
<a href="#cmdmbhw">2.23 Access Memory (mb, mh, and mw)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmkfatfs">2.24 Create a FAT Filesystem (mkfatfs)</a>
|
||||
<a href="#cmdps">2.24 Show Current Tasks and Threads (ps)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmkfifo">2.25 Create a FIFO (mkfifo)</a>
|
||||
<a href="#cmdmkdir">2.25 Create a Directory (mkdir)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmkrd">2.26 Create a RAMDISK (mkrd)</a>
|
||||
<a href="#cmdmkfatfs">2.26 Create a FAT Filesystem (mkfatfs)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmount">2.27 Mount a File System (mount)</a>
|
||||
<a href="#cmdmkfifo">2.27 Create a FIFO (mkfifo)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdmv">2.28 Rename a File (mv)</a>
|
||||
<a href="#cmdmkrd">2.28 Create a RAMDISK (mkrd)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdnfsmount">2.29 Mount an NFS file system (nfsmount)</a>
|
||||
<a href="#cmdmount">2.29 Mount a File System (mount)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdping">2.30 Check Network Peer (ping)</a>
|
||||
<a href="#cmdmv">2.30 Rename a File (mv)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdput">2.31 Send File Via TFTP (put)</a>
|
||||
<a href="#cmdnfsmount">2.31 Mount an NFS file system (nfsmount)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdpwd">2.32 Show Current Working Directory (pwd)</a>
|
||||
<a href="#cmdping">2.32 Check Network Peer (ping)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdrm">2.33 Remove a File (rm)</a>
|
||||
<a href="#cmdput">2.33 Send File Via TFTP (put)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdrmdir">2.34 Remove a Directory (rmdir)</a>
|
||||
<a href="#cmdpwd">2.34 Show Current Working Directory (pwd)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdset">2.35 Set an Environment Variable (set)</a>
|
||||
<a href="#cmdrm">2.35 Remove a File (rm)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdsh">2.36 Execute an NSH Script (sh)</a>
|
||||
<a href="#cmdrmdir">2.36 Remove a Directory (rmdir)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdsleep">2.37 Wait for Seconds (sleep)</a>
|
||||
<a href="#cmdset">2.37 Set an Environment Variable (set)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdunmount">2.38 Unmount a File System (umount)</a>
|
||||
<a href="#cmdsh">2.38 Execute an NSH Script (sh)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdunset">2.39 Unset an Environment Variable (unset)</a>
|
||||
<a href="#cmdsleep">2.39 Wait for Seconds (sleep)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdurldec">2.40 URL Decode (urldecode)</a>
|
||||
<a href="#cmdunmount">2.40 Unmount a File System (umount)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdurlencode">2.41 URL Encode (urlencode)</a>
|
||||
<a href="#cmdunset">2.41 Unset an Environment Variable (unset)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdusleep">2.42 Wait for Microseconds (usleep)</a>
|
||||
<a href="#cmdurldec">2.42 URL Decode (urldecode)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdwget">2.43 Get File Via HTTP (wget)</a>
|
||||
<a href="#cmdurlencode">2.43 URL Encode (urlencode)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdxd">2.44 Hexadecimal Dump (xd)</a>
|
||||
<a href="#cmdusleep">2.44 Wait for Microseconds (usleep)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdwget">2.45 Get File Via HTTP (wget)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><br></td>
|
||||
<td>
|
||||
<a href="#cmdxd">2.46 Hexadecimal Dump (xd)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1170,18 +1182,18 @@ help [-v] [<cmd>]
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdifconfig"><h2>2.16 Show Network Configuration (ifconfig)</h2></a>
|
||||
<a name="cmdifconfig"><h2>2.16 Manage Network Configuration (ifconfig)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Command Syntax:</b></p>
|
||||
<ul><pre>
|
||||
ifconfig [nic_name [ip_address]]
|
||||
ifconfig [nic_name [ip]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]]
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Synopsis</b>.
|
||||
Two forms of the <code>ifconfig</code>command are supported:
|
||||
Multiple forms of the <code>ifconfig</code>command are supported:
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
|
@ -1214,14 +1226,63 @@ eth0 HWaddr 00:18:11:80:10:06
|
|||
</p>
|
||||
<ul><pre>
|
||||
ifconfig nic_name ip_address
|
||||
</pre><ul>
|
||||
</pre></ul>
|
||||
</li>
|
||||
<li>
|
||||
Other forms <i>to be provided</i>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdkill"><h2>2.17 Send a signal to a task (kill)</h2></a>
|
||||
<a name="cmdifdown"><h2>2.17 Take a network down (ifdown)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Command Syntax:</b></p>
|
||||
<ul><pre>
|
||||
ifdown <nic-name>
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Synopsis</b>.
|
||||
Take down the interface identified by the name <nic-name>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Example:</b>
|
||||
</p>
|
||||
<ul><pre>
|
||||
ifdown eth0
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdifup"><h2>2.18 Bring a network up (ifup)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Command Syntax:</b></p>
|
||||
<ul><pre>
|
||||
ifup <nic-name>
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Synopsis</b>.
|
||||
Bring up down the interface identified by the name <nic-name>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Example:</b>
|
||||
</p>
|
||||
<ul><pre>
|
||||
ifup eth0
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdkill"><h2>2.19 Send a signal to a task (kill)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1262,7 +1323,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdlosetup"><h2>2.18 Setup/teardown the Loop Device (losetup)</h2></a>
|
||||
<a name="cmdlosetup"><h2>2.20 Setup/teardown the Loop Device (losetup)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1315,7 +1376,7 @@ losetup d <dev-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdls"><h2>2.19 List Directory Contents (ls)</h2></a>
|
||||
<a name="cmdls"><h2>2.21 List Directory Contents (ls)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1352,7 +1413,7 @@ ls [-lRs] <dir-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmd5"><h2>2.20 Calculate MD5 (md5)</h2></a>
|
||||
<a name="cmdmd5"><h2>2.22 Calculate MD5 (md5)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1369,7 +1430,7 @@ md5 [-f] <string or filepath>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmbhw"><h2>2.21 Access Memory (mb, mh, and mw)</h2></a>
|
||||
<a name="cmdmbhw"><h2>2.23 Access Memory (mb, mh, and mw)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1423,7 +1484,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdps"><h2>2.22 Show Current Tasks and Threads (ps)</h2></a>
|
||||
<a name="cmdps"><h2>2.24 Show Current Tasks and Threads (ps)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1449,7 +1510,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmkdir"><h2>2.23 Create a Directory (mkdir)</h2></a>
|
||||
<a name="cmdmkdir"><h2>2.25 Create a Directory (mkdir)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1484,7 +1545,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmkfatfs"><h2>2.24 Create a FAT Filesystem (mkfatfs)</h2></a>
|
||||
<a name="cmdmkfatfs"><h2>2.26 Create a FAT Filesystem (mkfatfs)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1504,7 +1565,7 @@ mkfatfs <path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmkfifo"><h2>2.25 Create a FIFO (mkfifo)</h2></a>
|
||||
<a name="cmdmkfifo"><h2>2.27 Create a FIFO (mkfifo)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1542,7 +1603,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmkrd"><h2>2.26 Create a RAMDISK (mkrd)</h2></a>
|
||||
<a name="cmdmkrd"><h2>2.28 Create a RAMDISK (mkrd)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1593,7 +1654,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmount"><h2>2.27 Mount a File System (mount)</h2></a>
|
||||
<a name="cmdmount"><h2>2.29 Mount a File System (mount)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1672,7 +1733,7 @@ nsh> mount
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdmv"><h2>2.28 Rename a File (mv)</h2></a>
|
||||
<a name="cmdmv"><h2>2.30 Rename a File (mv)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1690,7 +1751,7 @@ mv <old-path> <new-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdnfsmount"><h2>2.29 Mount an NFS file system (nfsmount)</h2></a>
|
||||
<a name="cmdnfsmount"><h2>2.31 Mount an NFS file system (nfsmount)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1709,7 +1770,7 @@ nfsmount <server-address> <mount-point> <remote-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdping"><h2>2.30 Check Network Peer (ping)</h2></a>
|
||||
<a name="cmdping"><h2>2.32 Check Network Peer (ping)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1742,7 +1803,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdput"><h2>2.31 Send File Via TFTP (put)</h2></a>
|
||||
<a name="cmdput"><h2>2.33 Send File Via TFTP (put)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1777,7 +1838,7 @@ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdpwd"><h2>2.32 Show Current Working Directory (pwd)</h2></a>
|
||||
<a name="cmdpwd"><h2>2.34 Show Current Working Directory (pwd)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1807,7 +1868,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdrm"><h2>2.33 Remove a File (rm)</h2></a>
|
||||
<a name="cmdrm"><h2>2.35 Remove a File (rm)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1841,7 +1902,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdrmdir"><h2>2.34 Remove a Directory (rmdir)</h2></a>
|
||||
<a name="cmdrmdir"><h2>2.36 Remove a Directory (rmdir)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1876,7 +1937,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdset"><h2>2.35 Set an Environment Variable (set)</h2></a>
|
||||
<a name="cmdset"><h2>2.37 Set an Environment Variable (set)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1902,7 +1963,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdsh"><h2>2.36 Execute an NSH Script (sh)</h2></a>
|
||||
<a name="cmdsh"><h2>2.38 Execute an NSH Script (sh)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1920,7 +1981,7 @@ sh <script-path>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdsleep"><h2>2.37 Wait for Seconds (sleep)</h2></a>
|
||||
<a name="cmdsleep"><h2>2.39 Wait for Seconds (sleep)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1937,7 +1998,7 @@ sleep <sec>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdunmount"><h2>2.38 Unmount a File System (umount)</h2></a>
|
||||
<a name="cmdunmount"><h2>2.40 Unmount a File System (umount)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1967,7 +2028,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdunset"><h2>2.39 Unset an Environment Variable (unset)</h2></a>
|
||||
<a name="cmdunset"><h2>2.41 Unset an Environment Variable (unset)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1993,7 +2054,7 @@ nsh>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdurldec"><h2>2.40 URL Decode (urldecode)</h2></a>
|
||||
<a name="cmdurldec"><h2>2.42 URL Decode (urldecode)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2010,7 +2071,7 @@ urldecode [-f] <string or filepath>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdurlencode"><h2>2.41 URL Encode (urlencode)</h2></a>
|
||||
<a name="cmdurlencode"><h2>2.43 URL Encode (urlencode)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2027,7 +2088,7 @@ urlencode [-f] <string or filepath>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdusleep"><h2>2.42 Wait for Microseconds (usleep)</h2></a>
|
||||
<a name="cmdusleep"><h2>2.44 Wait for Microseconds (usleep)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2044,7 +2105,7 @@ usleep <usec>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdwget">2.43 Get File Via HTTP (wget)</a>
|
||||
<a name="cmdwget">2.45 Get File Via HTTP (wget)</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2071,7 +2132,7 @@ wget [-o <local-path>] <url>
|
|||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="cmdxd"><h2>2.44 Hexadecimal dump (xd)</h2></a>
|
||||
<a name="cmdxd"><h2>2.46 Hexadecimal dump (xd)</h2></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -2215,6 +2276,16 @@ nsh>
|
|||
<td><code>CONFIG_NET</code></td>
|
||||
<td><code>CONFIG_NSH_DISABLE_IFCONFIG</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><code>ifdown</code></b></td>
|
||||
<td><code>CONFIG_NET</code></td>
|
||||
<td><code>CONFIG_NSH_DISABLE_IFUPDOWN</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><code>ifup</code></b></td>
|
||||
<td><code>CONFIG_NET</code></td>
|
||||
<td><code>CONFIG_NSH_DISABLE_IFUPDOWN</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b><code>kill</code></b></td>
|
||||
<td>!<code>CONFIG_DISABLE_SIGNALS</code></td>
|
||||
|
@ -3723,9 +3794,9 @@ mount -t vfat /dev/ram1 /tmp
|
|||
<li><a href="#startupscript"><code>/etc/init.d/rcS</code></a>
|
||||
<li><a href="#cmdexec"><code>exec</code></a></li>
|
||||
<li><a href="#custapps"><code>exec_namedapp()</code></a></li>
|
||||
<li><a href="#cmdexit"><code>exit</code></a></li>
|
||||
</ul></td>
|
||||
<td></ul>
|
||||
<li><a href="#cmdexit"><code>exit</code></a></li>
|
||||
<li><a href="#cmdfree"><code>free</code></a></li>
|
||||
<li><a href="#custoncmds"><code>g_cmdmap</code></a></li>
|
||||
<li><a href="#custinit"><code>genromfs</code></a></li>
|
||||
|
@ -3734,6 +3805,8 @@ mount -t vfat /dev/ram1 /tmp
|
|||
<li><a href="#cmdhelp"><code>help</code></a></li>
|
||||
<li><a href="#conditional"><code>if-then[-else]-fi</code></a></li>
|
||||
<li><a href="#cmdifconfig"><code>ifconfig</code></a></li>
|
||||
<li><a href="#cmdifdown"><code>ifdown</code></a></li>
|
||||
<li><a href="#cmdifup"><code>ifup</code></a></li>
|
||||
<li><a href="#custonshlib">Initialization sequence</a></li>
|
||||
<li><a href="#cmdkill"><code>kill</code></a></li>
|
||||
<li><a href="#cmdlosetup"><code>losetup</code></a></li>
|
||||
|
|
|
@ -52,6 +52,10 @@
|
|||
#define IF_NAMESIZE 6 /* Newer naming standard */
|
||||
#define IFHWADDRLEN 6
|
||||
|
||||
#define IFF_RUNNING (1 << 0)
|
||||
#define IF_FLAG_IFUP (1 << 0)
|
||||
#define IF_FLAG_IFDOWN (2 << 0)
|
||||
|
||||
/*******************************************************************************************
|
||||
* Public Type Definitions
|
||||
*******************************************************************************************/
|
||||
|
@ -72,6 +76,7 @@ struct lifreq
|
|||
struct sockaddr lifru_hwaddr; /* MAC address */
|
||||
int lifru_count; /* Number of devices */
|
||||
int lifru_mtu; /* MTU size */
|
||||
uint8_t lifru_flags; /* Interface flags */
|
||||
} lifr_ifru;
|
||||
};
|
||||
|
||||
|
@ -82,6 +87,7 @@ struct lifreq
|
|||
#define lifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define lifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define lifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
#define lifr_flags lifr_ifru.lifru_flags /* interface flags */
|
||||
|
||||
/* This is the older I/F request that should only be used with IPv4. However, since
|
||||
* NuttX only supports IPv4 or 6 (not both), we can force the older structure to
|
||||
|
@ -101,6 +107,7 @@ struct ifreq
|
|||
struct sockaddr ifru_hwaddr; /* MAC address */
|
||||
int ifru_count; /* Number of devices */
|
||||
int ifru_mtu; /* MTU size */
|
||||
uint8_t ifru_flags; /* Interface flags */
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
|
@ -111,6 +118,7 @@ struct ifreq
|
|||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* MTU */
|
||||
#define ifr_count ifr_ifru.ifru_count /* Number of devices */
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* interface flags */
|
||||
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
|
||||
|
@ -123,6 +131,7 @@ struct ifreq
|
|||
#define ifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define ifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
#define ifr_flags lifr_ifru.lifru_flags /* interface flags */
|
||||
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
|
|
|
@ -146,9 +146,15 @@
|
|||
|
||||
#define SIOCSIWPMKSA _SIOC(0x0036) /* PMKSA cache operation */
|
||||
|
||||
/* Interface flags */
|
||||
|
||||
#define SIOCSIFFLAGS _SIOC(0x0037) /* Sets the interface flags */
|
||||
#define SIOCGIFFLAGS _SIOC(0x0038) /* Gets the interface flags */
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* See include/net/if.h */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -90,6 +90,10 @@ struct uip_driver_s
|
|||
char d_ifname[IFNAMSIZ];
|
||||
#endif
|
||||
|
||||
/* Drivers interface flags. See IFF_* definitions in include/net/if.h */
|
||||
|
||||
uint8_t d_flags;
|
||||
|
||||
/* Ethernet device identity */
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
|
|
|
@ -138,19 +138,47 @@ static void ioctl_setipaddr(FAR uip_ipaddr_t *outaddr, FAR const void *inaddr)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void ioctl_ifup(FAR struct uip_driver_s *dev)
|
||||
static void ioctl_ifup(FAR struct uip_driver_s *dev)
|
||||
{
|
||||
/* Make sure that the device supports the d_ifup() method */
|
||||
|
||||
if (dev->d_ifup)
|
||||
{
|
||||
dev->d_ifup(dev);
|
||||
/* Is the interface already up? */
|
||||
|
||||
if ((dev->d_flags & IFF_RUNNING) == 0)
|
||||
{
|
||||
/* No, bring the interface up now */
|
||||
|
||||
if (dev->d_ifup(dev) == OK)
|
||||
{
|
||||
/* Mark the interface as up */
|
||||
|
||||
dev->d_flags |= IFF_RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ioctl_ifdown(FAR struct uip_driver_s *dev)
|
||||
static void ioctl_ifdown(FAR struct uip_driver_s *dev)
|
||||
{
|
||||
/* Make sure that the device supports the d_ifdown() method */
|
||||
|
||||
if (dev->d_ifdown)
|
||||
{
|
||||
dev->d_ifdown(dev);
|
||||
/* Is the interface already down? */
|
||||
|
||||
if ((dev->d_flags & IFF_RUNNING) != 0)
|
||||
{
|
||||
/* No, take the interface down now */
|
||||
|
||||
if (dev->d_ifdown(dev) == OK)
|
||||
{
|
||||
/* Mark the interface as down */
|
||||
|
||||
dev->d_flags &= ~IFF_RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,63 +222,130 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd, struct ifreq *req)
|
|||
|
||||
switch (cmd)
|
||||
{
|
||||
case SIOCGIFADDR: /* Get IP address */
|
||||
ioctl_getipaddr(&req->ifr_addr, &dev->d_ipaddr);
|
||||
case SIOCGIFADDR: /* Get IP address */
|
||||
{
|
||||
ioctl_getipaddr(&req->ifr_addr, &dev->d_ipaddr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFADDR: /* Set IP address */
|
||||
ioctl_ifdown(dev);
|
||||
ioctl_setipaddr(&dev->d_ipaddr, &req->ifr_addr);
|
||||
ioctl_ifup(dev);
|
||||
case SIOCSIFADDR: /* Set IP address */
|
||||
{
|
||||
ioctl_ifdown(dev);
|
||||
ioctl_setipaddr(&dev->d_ipaddr, &req->ifr_addr);
|
||||
ioctl_ifup(dev);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFDSTADDR: /* Get P-to-P address */
|
||||
ioctl_getipaddr(&req->ifr_dstaddr, &dev->d_draddr);
|
||||
{
|
||||
ioctl_getipaddr(&req->ifr_dstaddr, &dev->d_draddr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFDSTADDR: /* Set P-to-P address */
|
||||
ioctl_setipaddr(&dev->d_draddr, &req->ifr_dstaddr);
|
||||
{
|
||||
ioctl_setipaddr(&dev->d_draddr, &req->ifr_dstaddr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFNETMASK: /* Get network mask */
|
||||
ioctl_getipaddr(&req->ifr_addr, &dev->d_netmask);
|
||||
{
|
||||
ioctl_getipaddr(&req->ifr_addr, &dev->d_netmask);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFNETMASK: /* Set network mask */
|
||||
ioctl_setipaddr(&dev->d_netmask, &req->ifr_addr);
|
||||
{
|
||||
ioctl_setipaddr(&dev->d_netmask, &req->ifr_addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFMTU: /* Get MTU size */
|
||||
req->ifr_mtu = CONFIG_NET_BUFSIZE;
|
||||
{
|
||||
req->ifr_mtu = CONFIG_NET_BUFSIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFFLAGS: /* Sets the interface flags */
|
||||
{
|
||||
/* Is this a request to bring the interface up? */
|
||||
|
||||
if (req->ifr_flags & IF_FLAG_IFUP)
|
||||
{
|
||||
/* Yes.. bring the interface up */
|
||||
|
||||
ioctl_ifup(dev);
|
||||
}
|
||||
|
||||
/* Is this a request to take the interface down? */
|
||||
|
||||
else if (req->ifr_flags & IF_FLAG_IFDOWN)
|
||||
{
|
||||
/* Yes.. take the interface down */
|
||||
|
||||
ioctl_ifdown(dev);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFFLAGS: /* Gets the interface flags */
|
||||
{
|
||||
req->ifr_flags = 0;
|
||||
|
||||
/* Is the interface running? */
|
||||
|
||||
if (dev->d_flags & IFF_RUNNING)
|
||||
{
|
||||
/* Yes.. report interface up */
|
||||
|
||||
req->ifr_flags |= IF_FLAG_IFUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No.. report interface down */
|
||||
|
||||
req->ifr_flags |= IF_FLAG_IFDOWN;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* MAC address operations only make sense if Ethernet is supported */
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
case SIOCGIFHWADDR: /* Get hardware address */
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.ether_addr_octet, IFHWADDRLEN);
|
||||
{
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.ether_addr_octet, IFHWADDRLEN);
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFHWADDR: /* Set hardware address -- will not take effect until ifup */
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(dev->d_mac.ether_addr_octet, req->ifr_hwaddr.sa_data, IFHWADDRLEN);
|
||||
{
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(dev->d_mac.ether_addr_octet, req->ifr_hwaddr.sa_data, IFHWADDRLEN);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SIOCDIFADDR: /* Delete IP address */
|
||||
ioctl_ifdown(dev);
|
||||
memset(&dev->d_ipaddr, 0, sizeof(uip_ipaddr_t));
|
||||
{
|
||||
ioctl_ifdown(dev);
|
||||
memset(&dev->d_ipaddr, 0, sizeof(uip_ipaddr_t));
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFCOUNT: /* Get number of devices */
|
||||
req->ifr_count = netdev_count();
|
||||
ret = -ENOSYS;
|
||||
{
|
||||
req->ifr_count = netdev_count();
|
||||
ret = -ENOSYS;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFBRDADDR: /* Get broadcast IP address */
|
||||
case SIOCSIFBRDADDR: /* Set broadcast IP address */
|
||||
ret = -ENOSYS;
|
||||
case SIOCGIFBRDADDR: /* Get broadcast IP address */
|
||||
case SIOCSIFBRDADDR: /* Set broadcast IP address */
|
||||
{
|
||||
ret = -ENOSYS;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_NET_ARPIOCTLS
|
||||
|
@ -261,7 +356,9 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd, struct ifreq *req)
|
|||
#endif
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
break;;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue