Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell/gnrc_netif: Use netif API for ifconfig #12355

Merged
merged 4 commits into from
Nov 29, 2019

Conversation

leandrolanzieri
Copy link
Contributor

@leandrolanzieri leandrolanzieri commented Oct 2, 2019

Contribution description

This PR modifies the ifconfig and txtsnd command implementations to use the new netif API introduced in #11879. Some changes had to be made in tests as now the name for GNRC interfaces returns if<n> (that's the value returned by GNRC's implementation of netif_get_name).

This may be a first step towards having a generic implementation of this command, that does not depend on the stack that is currently being used.

For now the PR includes commits of #11879, I will rebase when it gets merged, but the changes on the commands can be reviewed anyway.

Testing procedure

  • Check that the commands work as expected
  • Run the modified tests, they should still work.

Issues/PRs references

Depends on #11879

@leandrolanzieri leandrolanzieri added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking labels Oct 2, 2019
@miri64
Copy link
Member

miri64 commented Oct 3, 2019

More motivation to finally continue working on #9343 and adapt it to #11879 :-)

@leandrolanzieri leandrolanzieri force-pushed the pr/ifconfig_using_netif branch from 1887acf to ab85840 Compare October 11, 2019 10:08
@leandrolanzieri
Copy link
Contributor Author

Rebased now that #11879 has been merged.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git mv sys/shell/commands/sc_gnrc_netif.c sys/shell/commands/sc_netif.c

?

@leandrolanzieri
Copy link
Contributor Author

git mv sys/shell/commands/sc_gnrc_netif.c sys/shell/commands/sc_netif.c

?

Maybe it's better to rename it after all GNRC dependencies are removed

smlng
smlng previously requested changes Oct 17, 2019
sys/shell/commands/sc_gnrc_netif.c Show resolved Hide resolved
@smlng smlng dismissed their stale review October 28, 2019 20:40

need time for testing, won't block either though

@smlng smlng added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Nov 7, 2019
@leandrolanzieri leandrolanzieri force-pushed the pr/ifconfig_using_netif branch from ab85840 to 9864fb0 Compare November 7, 2019 21:03
@leandrolanzieri
Copy link
Contributor Author

Rebased to current master

@leandrolanzieri
Copy link
Contributor Author

@miri64 @smlng @jia200x Would it make sense to modify GNRC's implementation of netif_get_name so it does not include if in the interfaces name? Maybe the impact is less: we would not need to change the tests and risk to break existing scripts that already depend on these names.

@miri64
Copy link
Member

miri64 commented Nov 7, 2019

@miri64 @smlng @jia200x Would it make sense to modify GNRC's implementation of netif_get_name so it does not include if in the interfaces name? Maybe the impact is less: we would not need to change the tests and risk to break existing scripts that already depend on these names.

Yes, that would make sense. There is no specific reason why I added the if-prefix, other than having it more "name-like". #12667 still makes sense though, as non-GNRC stacks might use actually different names (see lwIP e.g.)

@leandrolanzieri leandrolanzieri force-pushed the pr/ifconfig_using_netif branch from 9864fb0 to 7bdd0ed Compare November 8, 2019 08:27
@leandrolanzieri
Copy link
Contributor Author

@miri64 I removed the prefix from the name and reverted the changes in tests.

@leandrolanzieri
Copy link
Contributor Author

I've adapted the GNRC netif tests according to the new names.

@tcschmidt
Copy link
Member

@smlng can you start testing this?

@brummer-simon
Copy link
Member

I was asked to run the gnrc_tcp tests on this PR because they rely on the output of ifconfig. From my point of view everything works as it should.

@rosetree
Copy link

The current master surrounds the interface number with 2 spaces. After this change it’s only one space.

 > ifconfig
 ifconfig
-Iface  6  HWaddr: C2:1F:EE:FD:61:CB 
+Iface 6 HWaddr: C2:1F:EE:FD:61:CB 
           L2-PDU:1500 MTU:1500  HL:64  RTR  

@leandrolanzieri
Copy link
Contributor Author

The current master surrounds the interface number with 2 spaces. After this change it’s only one space.

 > ifconfig
 ifconfig
-Iface  6  HWaddr: C2:1F:EE:FD:61:CB 
+Iface 6 HWaddr: C2:1F:EE:FD:61:CB 
           L2-PDU:1500 MTU:1500  HL:64  RTR  

Thanks @rosetree! I added the missing spaces.

@leandrolanzieri leandrolanzieri removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 26, 2019
@rosetree
Copy link

At the Hack ’n’ ACK I tested the following commands, some native and some on the SAMR21 board:

  • ifconfig (native + samr21)
  • ifconfig 7 del <ip_addr> (samr21)
  • ifconfig 7 add multicast <ip_addr> (samr21) – though I didn’t
    manage to set the ip address sucessfully
  • ifconfig 6 stats ipv6 reset (native)
  • ifconfig 6 stats ipv6 (native)
  • ifconfig 6 stats l2 (native)
  • ifconfig 6 stats (native)
  • ifconfig 6 set chan 12 (samr21), error case
  • ifconfig 7 set chan 12 (samr21)
  • ifconfig 7 set csma_retries 7 (samr21), error case
  • ifconfig 7 set csma_retries 5 (samr21)

I executed the commands on both the master branch (37dc677) and the pull request branch, saved the outputs to text files and compared them with diff. I didn’t see differences between both versions, besides from different counter values in some cases.

@PeterKietzmann
Copy link
Member

@rosetree as discussed offline, please report about the other tests that you did (which succeeded). Furthermore, I ran gnrc_networking on a samr21-xpro using this PR and current master, and compared different outputs, all of which looked similar (besides that IPv6 address generation has changed in the meantime). In more detail I compared:

  • ifconfig
  • ifconfig 7 del <IPv6 addr>
  • ifconfig 7 add <IPv6 addr>

-> all good

@PeterKietzmann
Copy link
Member

@smlng hope this helps you a bit :-)

@smlng
Copy link
Member

smlng commented Nov 29, 2019

please rebase and squash

@leandrolanzieri
Copy link
Contributor Author

@smlng done

Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested ACK, though I couldn't test all possible interface variants out there

@smlng smlng added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Reviewed: 3-testing The PR was tested according to the maintainer guidelines labels Nov 29, 2019
@smlng
Copy link
Member

smlng commented Nov 29, 2019

let's see how Murdock feels about it 😄

@smlng smlng merged commit 6ae8ffb into RIOT-OS:master Nov 29, 2019
@leandrolanzieri leandrolanzieri deleted the pr/ifconfig_using_netif branch November 29, 2019 12:10
@leandrolanzieri
Copy link
Contributor Author

Thanks all for reviewing and testing!

@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants