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

[Multi-ASIC] To pass the asic instance ID to orchagent, Advance the swss, swss-common submodules. #4465

Merged
merged 5 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dockers/docker-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ ORCHAGENT_ARGS="-d /var/log/swss "
# Set orchagent pop batch size to 8192
ORCHAGENT_ARGS+="-b 8192 "

# Check if there is an "asic_id field" in the DEVICE_METADATA in configDB.
#"DEVICE_METADATA": {
# "localhost": {
# ....
# "asic_id": "0",
# }
#},
# ID field could be integers just to denote the asic instance like 0,1,2...
# OR could be PCI device ID's which will be strings like "03:00.0"
# depending on what the SAI/SDK expects.
asic_id=`sonic-cfggen -d -v DEVICE_METADATA.localhost.asic_id`
if [ -n "$asic_id" ]
then
ORCHAGENT_ARGS+="-i $asic_id "
Copy link
Collaborator

Choose a reason for hiding this comment

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

$asic_id [](start = 24, length = 8)

There is security risk that attacker tamper the asic_id in Redis and run any command.

Copy link
Collaborator

Choose a reason for hiding this comment

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

good call.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i put this as a todo list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure Guohan, will take it up as a follow up action. But wanted to add one more point to this.

Currently we pass the instance ID as integers 0,1,2. It will be changed in future to pass the PCI device ID's when we update the new SAI will accepts PCI device IDs. The config DB will be populated with PCI device ID's in this field "DEVICE_METADATA.localhost.asic_id" and will be passed on when starting orchagent process.

This should be safe ? if we pass a wrong PCI device id ( may be by an attacker) ... the SAI create switch will fail and syncd won't come up...

fi

# Add platform specific arguments if necessary
if [ "$platform" == "broadcom" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-swss
2 changes: 1 addition & 1 deletion src/sonic-swss-common