[riot-notifications] [RIOT-OS/RIOT] sys/shell lwIP: Expand ifconfig command (#16868)

Erik Ekman notifications at github.com
Sat Sep 18 13:21:09 CEST 2021


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->

Add features to lwIP ifconfig:

* Listing a single interface
* Setting interface up or down (interface state, not link state)
* Showing which interface is default route
* Setting interface as default route
* Showing DHCP status
* Starting/stopping DHCP



### Testing procedure

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->

Flash an app using lwIP and try out the `ifconfig` command

Example session:
```
> ifconfig
Iface ET0 HWaddr: 24:0a:c4:e6:0e:9f  Link: up    State: up    Default route
        Link type: wired
        inet addr: 10.4.4.81 mask: 255.255.254.0 gw: 10.4.4.1 dhcp: bound
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9f scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9f scope: global
Iface ET1 HWaddr: 24:0a:c4:e6:0e:9c  Link: up    State: up    
        Link type: wireless
        inet addr: 10.4.4.86 mask: 255.255.254.0 gw: 10.4.4.1 dhcp: bound
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9c scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9c scope: global
> ifconfig ET0 dhcp stop
Releasing bound address
> ifconfig ET0
Iface ET0 HWaddr: 24:0a:c4:e6:0e:9f  Link: up    State: up    Default route
        Link type: wired
        inet addr: 0.0.0.0 mask: 0.0.0.0 gw: 0.0.0.0 dhcp: off
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9f scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9f scope: global
> ifconfig ET0 down
> ifconfig ET0
Iface ET0 HWaddr: 24:0a:c4:e6:0e:9f  Link: up    State: down  Default route
        Link type: wired
        inet addr: 0.0.0.0 mask: 0.0.0.0 gw: 0.0.0.0 dhcp: off
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9f scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9f scope: global
> ifconfig ET1 default
> ifconfig
Iface ET0 HWaddr: 24:0a:c4:e6:0e:9f  Link: up    State: down
        Link type: wired
        inet addr: 0.0.0.0 mask: 0.0.0.0 gw: 0.0.0.0 dhcp: off
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9f scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9f scope: global
Iface ET1 HWaddr: 24:0a:c4:e6:0e:9c  Link: up    State: up    Default route
        Link type: wireless
        inet addr: 10.4.4.86 mask: 255.255.254.0 gw: 10.4.4.1 dhcp: bound
        inet6 addr: fe80:0:0:0:260a:c4ff:fee6:e9c scope: link
        inet6 addr: 2001:db8:0:0:260a:c4ff:fee6:e9c scope: global
```

### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

None
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16868

-- Commit Summary --

  * sys/shell: lwIP: Print single netif
  * sys/shell: lwIP: Allow setting netifs up/down
  * sys/shell: lwIP: Show and set default netif
  * sys/shell: lwIP: Use double spaces on first line
  * sys/shell: lwIP: Update ifconfig help text
  * sys/shell: lwIP: Show dhcp status
  * sys/shell: lwIP: Add command to start/stop DHCP

-- File Changes --

    M sys/shell/commands/sc_lwip_netif.c (98)
    M sys/shell/commands/shell_commands.c (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16868.patch
https://github.com/RIOT-OS/RIOT/pull/16868.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16868
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210918/b1c16db7/attachment.htm>


More information about the notifications mailing list