Jonathan Hart

Explicitly set address length when creating a new host

...@@ -167,6 +167,7 @@ public class ProxyArpManager implements ProxyArpService { ...@@ -167,6 +167,7 @@ public class ProxyArpManager implements ProxyArpService {
167 return; 167 return;
168 } 168 }
169 169
170 + // TODO find the correct IP address
170 Ethernet arpReply = buildArpReply(dst.ipAddresses().iterator().next(), 171 Ethernet arpReply = buildArpReply(dst.ipAddresses().iterator().next(),
171 dst.mac(), eth); 172 dst.mac(), eth);
172 // TODO: check send status with host service. 173 // TODO: check send status with host service.
......
1 package org.onlab.onos.provider.of.host.impl; 1 package org.onlab.onos.provider.of.host.impl;
2 2
3 +import static org.onlab.onos.net.DeviceId.deviceId;
4 +import static org.onlab.onos.net.PortNumber.portNumber;
5 +import static org.slf4j.LoggerFactory.getLogger;
6 +
3 import org.apache.felix.scr.annotations.Activate; 7 import org.apache.felix.scr.annotations.Activate;
4 import org.apache.felix.scr.annotations.Component; 8 import org.apache.felix.scr.annotations.Component;
5 import org.apache.felix.scr.annotations.Deactivate; 9 import org.apache.felix.scr.annotations.Deactivate;
...@@ -29,10 +33,6 @@ import org.onlab.packet.IpPrefix; ...@@ -29,10 +33,6 @@ import org.onlab.packet.IpPrefix;
29 import org.onlab.packet.VlanId; 33 import org.onlab.packet.VlanId;
30 import org.slf4j.Logger; 34 import org.slf4j.Logger;
31 35
32 -import static org.onlab.onos.net.DeviceId.deviceId;
33 -import static org.onlab.onos.net.PortNumber.portNumber;
34 -import static org.slf4j.LoggerFactory.getLogger;
35 -
36 /** 36 /**
37 * Provider which uses an OpenFlow controller to detect network 37 * Provider which uses an OpenFlow controller to detect network
38 * end-station hosts. 38 * end-station hosts.
...@@ -110,14 +110,16 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid ...@@ -110,14 +110,16 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid
110 // Potentially a new or moved host 110 // Potentially a new or moved host
111 if (eth.getEtherType() == Ethernet.TYPE_ARP) { 111 if (eth.getEtherType() == Ethernet.TYPE_ARP) {
112 ARP arp = (ARP) eth.getPayload(); 112 ARP arp = (ARP) eth.getPayload();
113 - IpPrefix ip = IpPrefix.valueOf(arp.getSenderProtocolAddress()); 113 + IpPrefix ip = IpPrefix.valueOf(arp.getSenderProtocolAddress(),
114 + IpPrefix.MAX_INET_MASK);
114 HostDescription hdescr = 115 HostDescription hdescr =
115 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip); 116 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip);
116 providerService.hostDetected(hid, hdescr); 117 providerService.hostDetected(hid, hdescr);
117 118
118 } else if (ipLearn && eth.getEtherType() == Ethernet.TYPE_IPV4) { 119 } else if (ipLearn && eth.getEtherType() == Ethernet.TYPE_IPV4) {
119 IPv4 pip = (IPv4) eth.getPayload(); 120 IPv4 pip = (IPv4) eth.getPayload();
120 - IpPrefix ip = IpPrefix.valueOf(pip.getSourceAddress()); 121 + IpPrefix ip = IpPrefix.valueOf(pip.getSourceAddress(),
122 + IpPrefix.MAX_INET_MASK);
121 HostDescription hdescr = 123 HostDescription hdescr =
122 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip); 124 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip);
123 providerService.hostDetected(hid, hdescr); 125 providerService.hostDetected(hid, hdescr);
......