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

AnyDevice: Ensure non-existent devices are added to the device map #57

Merged
merged 1 commit into from
Aug 28, 2012

Conversation

kph
Copy link
Contributor

@kph kph commented Aug 23, 2012

The logic rework in ae76f68
introduced a subtle bug. If a FromDevice/ToDevice/ToHost element
uses ALLOW_NONEXISTENT true, AnyDevice::set_device() would fail
to enter the device into the AnyDeviceMap.

The problem is that set_device() assumes that since _dev == dev
(which will happen in the non-existent case since NULL == NULL)
this is a carrier change only, and it exits early without ever
entering the device in the map.

The previous implementation of AnyDevice::find_device() did not
have this problem, as it would insert the device unconditionally.

Check explicitly for this case (new device being inserted, and it
is a non-existent device, and it is not in the map already), and
add it to the map.

Signed-off-by: Kevin Paul Herbert kph@meraki.net

The logic rework in ae76f68
introduced a subtle bug. If a FromDevice/ToDevice/ToHost element
uses ALLOW_NONEXISTENT true, AnyDevice::set_device() would fail
to enter the device into the AnyDeviceMap.

The problem is that set_device() assumes that since _dev == dev
(which will happen in the non-existent case since NULL == NULL)
this is a carrier change only, and it exits early without ever
entering the device in the map.

The previous implementation of AnyDevice::find_device() did not
have this problem, as it would insert the device unconditionally.

Check explicitly for this case (new device being inserted, and it
is a non-existent device, and it is not in the map already), and
add it to the map.

Signed-off-by: Kevin Paul Herbert <kph@meraki.net>
kohler added a commit that referenced this pull request Aug 28, 2012
AnyDevice: Ensure non-existent devices are added to the device map
@kohler kohler merged commit e38c625 into kohler:master Aug 28, 2012
@kohler
Copy link
Owner

kohler commented Aug 28, 2012

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants