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

T7076: Add script to validate ethernet interface #4327

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

natali-rs1985
Copy link
Contributor

Change summary

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe): add stricter validation for ethernet interfaces

Related Task(s)

Related PR(s)

vyos/vyos-vpp#6

How to test / Smoketest result

vyos@vyos# ls /sys/class/net/
dum0  eth0  eth1  eth2  eth3  lo  pim6reg
[edit]
vyos@vyos# set vpp settings interface dum0

  Error: dum0 is not an ehternet interface



  Invalid interface name
  Value validation failed
  Set failed

[edit]
vyos@vyos# set vpp settings interface eth99

  Error: eth99 does not exist in the system



  Invalid interface name
  Value validation failed
  Set failed

[edit]
vyos@vyos# set vpp settings interface eth1
[edit]
vyos@vyos#

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Jan 31, 2025

👍
No issues in PR Title / Commit Title

@@ -0,0 +1,13 @@
#!/bin/sh

if [[ "$1" != eth* ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

python/vyos/ifconfig/ethernet.py lists the following ethernet interface name regex: (lan|eth|eno|ens|enp|enx)[0-9]+$

As some boards/flavors in the past used lan as interface name. We should thing if this is really what we want or streamline everything to eth - which could mix up the labelling on the appliance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zdc should I add this regex (lan|eth|eno|ens|enp|enx)[0-9]+$ to check all possible ethernet interfaces?

Copy link
Member

Choose a reason for hiding this comment

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

We do not allow other names for vpp
Initially, this validator was created to check this https://vyos.dev/T7076
I'm not against (lan|eth|eno|ens|enp|enx)[0-9]+$ if it can be reused for some other checks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

Copy link

github-actions bot commented Feb 4, 2025

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

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

We may use non-eth names in the future on some platforms and we have other scripts with that regex, so let's do that.

@dmbaturin dmbaturin merged commit 41a5ca0 into vyos:current Feb 4, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants