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

Honda: fix alt brake address check race condition #1723

Merged
merged 18 commits into from
Nov 21, 2023
Merged

Conversation

sshane
Copy link
Contributor

@sshane sshane commented Nov 17, 2023

Caught by commaai/openpilot#30443. Should just make the rx hook not consider the address if it's not in our set of addresses. Right now it's totally ignoring either the powertrain data msg, or the brake module msg depending on which it sees first.

This PR uses the safety param to add the addr check.

PR to add true whitelisting: #1732

@sshane sshane added car safety vehicle-specific safety code tests bugfix labels Nov 17, 2023
@sshane sshane mentioned this pull request Nov 20, 2023
1 task
Comment on lines 398 to +414
safety_config ret;
if (honda_bosch_radarless && honda_alt_brake_msg) {
SET_RX_CHECKS(honda_common_alt_brake_rx_checks, ret);
} else if (honda_bosch_radarless) {
SET_RX_CHECKS(honda_common_rx_checks, ret);
} else if (honda_alt_brake_msg) {
SET_RX_CHECKS(honda_bosch_alt_brake_rx_checks, ret);
} else {
SET_RX_CHECKS(honda_bosch_rx_checks, ret);
}

if (honda_bosch_radarless) {
ret = honda_bosch_long ? BUILD_SAFETY_CFG(honda_common_rx_checks, HONDA_RADARLESS_LONG_TX_MSGS) : \
BUILD_SAFETY_CFG(honda_common_rx_checks, HONDA_RADARLESS_TX_MSGS);
honda_bosch_long ? SET_TX_MSGS(HONDA_RADARLESS_LONG_TX_MSGS, ret) : \
SET_TX_MSGS(HONDA_RADARLESS_TX_MSGS, ret);
} else {
ret = honda_bosch_long ? BUILD_SAFETY_CFG(honda_bosch_rx_checks, HONDA_BOSCH_LONG_TX_MSGS) : \
BUILD_SAFETY_CFG(honda_bosch_rx_checks, HONDA_BOSCH_TX_MSGS);
honda_bosch_long ? SET_TX_MSGS(HONDA_BOSCH_LONG_TX_MSGS, ret) : \
SET_TX_MSGS(HONDA_BOSCH_TX_MSGS, ret);
Copy link
Contributor Author

@sshane sshane Nov 21, 2023

Choose a reason for hiding this comment

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

@adeebshihadeh is setting the rx/tx messages piecemeal okay? If not the if statement block would be pretty large since the refactor. We can use BUILD_SAFETY_CFG if we store the count again, but needs the old macro and addr struct anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, let's just make it clean

@sshane sshane force-pushed the honda-fix-alt-brake branch from 4a0282d to 5091068 Compare November 21, 2023 03:23
@sshane sshane merged commit 42a6293 into master Nov 21, 2023
@sshane sshane deleted the honda-fix-alt-brake branch November 21, 2023 03:27
adeebshihadeh added a commit that referenced this pull request Nov 25, 2023
@sshane sshane restored the honda-fix-alt-brake branch November 25, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix car safety vehicle-specific safety code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants