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

Skip marking Com port as a zedrouterport #4482

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

andrewd-zededa
Copy link
Contributor

An alternate fix to PR #4460

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

This fixes the immediate issue and leaves us time to figure out why we don't set ifname for WLAN and WWAN interfaces.

But logically it makes sense to check for types.IoNet* - things that are not of those types should never have isPort set.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

Let's go ahead and merge this now given testing and time constraints.

@eriknordmark eriknordmark added the stable Should be backported to stable release(s) label Dec 13, 2024
Copy link
Member

@uncleDecart uncleDecart left a comment

Choose a reason for hiding this comment

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

LGTM from my side

@rene
Copy link
Contributor

rene commented Dec 13, 2024

@andrewd-zededa , I would add a comment to the code regarding the IsPort() issue (that still needs to be fixed).... worth to put it in the commit message as well (and get rid of the lint error)....

Are other I/O adapter types (specially HDMI) susceptible to the same issue?

@eriknordmark
Copy link
Contributor

Note that the device with the original failure has this in /run/zedagent/PhysicalIOAdapterList/*.json:
{
"Ptype": 6,
"Phylabel": "wwan0",
"Phyaddr": {
"PciLong": "",
"Ifname": "",
"Serial": "",
"Irq": "",
"Ioports": "",
"UsbAddr": "2:6",
"UsbProduct": "",
"UnknownType": ""
},
"Logicallabel": "wwan0",
"Assigngrp": "wwan0",
"Parentassigngrp": "",
"Usage": 1,
"UsagePolicy": {
"FreeUplink": false
},
"Vfs": {
"Count": 0,
"Data": null
},
"Cbattr": null
}

The fact that this has an empty ifname and is a management port (FWIW app-shared would cause the same issue) means that the original IsPort will declare that all ports with an empty ifname will match.
The fix in this PR (and the more general fix of only calling IsPort() for IsNet type adapters will avoid that mismatch.
But with the above model the wwan0 interface will not be usable as a management port since the logic to walk the management ports to to get the list of ifnames and then try sending out each ifname.
We can solve both issues by merely updating the model(s) hence PhysicalIOAdapterList to have an ifname for the WWAN port, or adding code in parseconfig.go to set ifname if missing for the WWAN port. (Later we can complete the intent in 65852ac to not rely on ifname to use and walk the network adapters, but that requires some more work to never rely on fixed ifnames from the model/PhysicalIOAdapterList.

Skip over HDMI, COM.  IsPort only checks Ifname which can
incorrectly flag non-net devices as a port.

Signed-off-by: Andrew Durbin <[email protected]>
@andrewd-zededa
Copy link
Contributor Author

@rene @eriknordmark moved to using ib.Type.IsNet() to broaden this check to all non-net devices.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.90%. Comparing base (a73c78d) to head (6ac0402).
Report is 52 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4482      +/-   ##
==========================================
- Coverage   20.93%   20.90%   -0.03%     
==========================================
  Files          13       13              
  Lines        2895     2894       -1     
==========================================
- Hits          606      605       -1     
  Misses       2163     2163              
  Partials      126      126              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable Should be backported to stable release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants