Committed by
Gerrit Code Review
ONOS-2800 Preventing learning of IP 0.0.0.0
Change-Id: Ic16d4cf847edef671f1c62018afd0eb3f7585e2d
Showing
1 changed file
with
6 additions
and
6 deletions
... | @@ -72,8 +72,8 @@ import static com.google.common.base.Strings.isNullOrEmpty; | ... | @@ -72,8 +72,8 @@ import static com.google.common.base.Strings.isNullOrEmpty; |
72 | import static org.slf4j.LoggerFactory.getLogger; | 72 | import static org.slf4j.LoggerFactory.getLogger; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | - * Provider which uses an OpenFlow controller to detect network | 75 | + * Provider which uses an OpenFlow controller to detect network end-station |
76 | - * end-station hosts. | 76 | + * hosts. |
77 | */ | 77 | */ |
78 | @Component(immediate = true) | 78 | @Component(immediate = true) |
79 | public class HostLocationProvider extends AbstractProvider implements HostProvider { | 79 | public class HostLocationProvider extends AbstractProvider implements HostProvider { |
... | @@ -289,7 +289,9 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid | ... | @@ -289,7 +289,9 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid |
289 | private void updateLocationIP(HostId hid, MacAddress mac, | 289 | private void updateLocationIP(HostId hid, MacAddress mac, |
290 | VlanId vlan, HostLocation hloc, | 290 | VlanId vlan, HostLocation hloc, |
291 | IpAddress ip) { | 291 | IpAddress ip) { |
292 | - HostDescription desc = new DefaultHostDescription(mac, vlan, hloc, ip); | 292 | + HostDescription desc = ip.isZero() ? |
293 | + new DefaultHostDescription(mac, vlan, hloc) : | ||
294 | + new DefaultHostDescription(mac, vlan, hloc, ip); | ||
293 | try { | 295 | try { |
294 | providerService.hostDetected(hid, desc); | 296 | providerService.hostDetected(hid, desc); |
295 | } catch (IllegalStateException e) { | 297 | } catch (IllegalStateException e) { |
... | @@ -323,9 +325,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid | ... | @@ -323,9 +325,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid |
323 | return; | 325 | return; |
324 | } | 326 | } |
325 | 327 | ||
326 | - HostLocation hloc = | 328 | + HostLocation hloc = new HostLocation(heardOn, System.currentTimeMillis()); |
327 | - new HostLocation(heardOn, System.currentTimeMillis()); | ||
328 | - | ||
329 | HostId hid = HostId.hostId(eth.getSourceMAC(), vlan); | 329 | HostId hid = HostId.hostId(eth.getSourceMAC(), vlan); |
330 | 330 | ||
331 | // ARP: possible new hosts, update both location and IP | 331 | // ARP: possible new hosts, update both location and IP | ... | ... |
-
Please register or login to post a comment