Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
fd1af314
Commit
fd1af314
authored
13 years ago
by
Kanzhe Jiang
Browse files
Options
Downloads
Patches
Plain Diff
learn ip on ARP reply only and update network address lastseen on all ip packets
parent
80a1d691
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+29
-31
29 additions, 31 deletions
...tcontroller/devicemanager/internal/DeviceManagerImpl.java
with
29 additions
and
31 deletions
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+
29
−
31
View file @
fd1af314
...
@@ -773,7 +773,9 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -773,7 +773,9 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
devMgrMaps
.
updateMaps
(
device
);
devMgrMaps
.
updateMaps
(
device
);
writeDeviceToStorage
(
device
,
currentDate
);
writeDeviceToStorage
(
device
,
currentDate
);
updateStatus
(
device
,
true
);
updateStatus
(
device
,
true
);
log
.
debug
(
"New device learned {}"
,
device
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"New device learned {}"
,
device
);
}
}
}
private
boolean
isGratArp
(
Ethernet
eth
)
{
private
boolean
isGratArp
(
Ethernet
eth
)
{
...
@@ -795,15 +797,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -795,15 +797,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
}
}
}
else
if
(
eth
.
getPayload
()
instanceof
IPv4
)
{
}
else
if
(
eth
.
getPayload
()
instanceof
IPv4
)
{
IPv4
ipv4
=
(
IPv4
)
eth
.
getPayload
();
IPv4
ipv4
=
(
IPv4
)
eth
.
getPayload
();
if
(
ipv4
.
getPayload
()
instanceof
UDP
)
{
return
ipv4
.
getSourceAddress
();
UDP
udp
=
(
UDP
)
ipv4
.
getPayload
();
if
(
udp
.
getPayload
()
instanceof
DHCP
)
{
DHCP
dhcp
=
(
DHCP
)
udp
.
getPayload
();
if
(
dhcp
.
getOpCode
()
==
DHCP
.
OPCODE_REPLY
)
{
return
ipv4
.
getSourceAddress
();
}
}
}
}
}
return
0
;
return
0
;
}
}
...
@@ -881,9 +875,13 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -881,9 +875,13 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
if
(
networkAddress
!=
null
)
{
if
(
networkAddress
!=
null
)
{
updateNetworkAddressLastSeen
=
true
;
updateNetworkAddressLastSeen
=
true
;
}
else
if
(
eth
!=
null
&&
(
eth
.
getPayload
()
instanceof
ARP
))
{
}
else
if
(
eth
!=
null
&&
(
eth
.
getPayload
()
instanceof
ARP
))
{
networkAddress
=
new
DeviceNetworkAddress
(
nwSrc
,
ARP
arp
=
(
ARP
)
eth
.
getPayload
();
// Only learn new MAC-IP mapping on ARP reply
if
(
arp
.
getOpCode
()
==
0x02
)
{
networkAddress
=
new
DeviceNetworkAddress
(
nwSrc
,
currentDate
);
currentDate
);
newNetworkAddress
=
true
;
newNetworkAddress
=
true
;
}
}
}
// Also, if this address is currently mapped to a different
// Also, if this address is currently mapped to a different
...
@@ -913,7 +911,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -913,7 +911,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
new
Object
[]
{
networkAddress
,
new
Object
[]
{
networkAddress
,
HexString
.
toHexString
(
deviceByNwaddr
.
getDataLayerAddress
()),
HexString
.
toHexString
(
deviceByNwaddr
.
getDataLayerAddress
()),
HexString
.
toHexString
(
device
.
getDataLayerAddress
()),
HexString
.
toHexString
(
device
.
getDataLayerAddress
()),
eth
});
eth
.
toString
()
});
}
}
}
}
...
@@ -946,8 +944,8 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -946,8 +944,8 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
if
(
newNetworkAddress
)
{
if
(
newNetworkAddress
)
{
// add the address
// add the address
nd
.
addNetworkAddress
(
networkAddress
);
nd
.
addNetworkAddress
(
networkAddress
);
log
.
debug
(
"Device {} added IP {}"
,
log
.
info
(
"Device {} added IP
{}, packet
{}"
,
nd
,
IPv4
.
fromIPv4Address
(
nwSrc
));
new
Object
[]
{
nd
,
IPv4
.
fromIPv4Address
(
nwSrc
)
,
eth
.
toString
()}
);
}
}
if
(
updateDeviceVlan
)
{
if
(
updateDeviceVlan
)
{
...
@@ -1544,7 +1542,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -1544,7 +1542,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
// ********************
// ********************
public
boolean
readPortChannelConfigFromStorage
()
{
public
boolean
readPortChannelConfigFromStorage
()
{
devMgrMaps
.
clearPortChannelMap
();
devMgrMaps
.
clearPortChannelMap
();
try
{
try
{
IResultSet
pcResultSet
=
storageSource
.
executeQuery
(
IResultSet
pcResultSet
=
storageSource
.
executeQuery
(
...
@@ -2178,20 +2176,20 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
...
@@ -2178,20 +2176,20 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
deviceManagerAware
.
add
(
listener
);
deviceManagerAware
.
add
(
listener
);
}
}
@Override
@Override
public
Map
<
String
,
Object
>
getInfo
(
String
type
)
{
public
Map
<
String
,
Object
>
getInfo
(
String
type
)
{
if
(!
"summary"
.
equals
(
type
))
if
(!
"summary"
.
equals
(
type
))
return
null
;
return
null
;
Map
<
String
,
Object
>
info
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
info
=
new
HashMap
<
String
,
Object
>();
info
.
put
(
"# hosts"
,
devMgrMaps
.
dataLayerAddressDeviceMap
.
size
());
info
.
put
(
"# hosts"
,
devMgrMaps
.
dataLayerAddressDeviceMap
.
size
());
info
.
put
(
"# IP Addresses"
,
devMgrMaps
.
ipv4AddressDeviceMap
.
size
());
info
.
put
(
"# IP Addresses"
,
devMgrMaps
.
ipv4AddressDeviceMap
.
size
());
int
num_aps
=
0
;
int
num_aps
=
0
;
for
(
Map
<
Integer
,
Device
>
devAps
:
devMgrMaps
.
switchPortDeviceMap
.
values
())
for
(
Map
<
Integer
,
Device
>
devAps
:
devMgrMaps
.
switchPortDeviceMap
.
values
())
num_aps
+=
devAps
.
size
();
num_aps
+=
devAps
.
size
();
info
.
put
(
"# attachment points"
,
num_aps
);
info
.
put
(
"# attachment points"
,
num_aps
);
return
info
;
return
info
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment