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
7fa00457
Commit
7fa00457
authored
12 years ago
by
Alex Reimers
Browse files
Options
Downloads
Patches
Plain Diff
VirtualNetworkFilter - Handle ARP to the gateway.
parent
a847b488
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/virtualnetwork/forwarding/VirtualNetworkFilter.java
+22
-0
22 additions, 0 deletions
...oller/virtualnetwork/forwarding/VirtualNetworkFilter.java
with
22 additions
and
0 deletions
src/main/java/net/floodlightcontroller/virtualnetwork/forwarding/VirtualNetworkFilter.java
+
22
−
0
View file @
7fa00457
...
...
@@ -32,6 +32,7 @@ import net.floodlightcontroller.core.module.FloodlightModuleException;
import
net.floodlightcontroller.core.module.IFloodlightModule
;
import
net.floodlightcontroller.core.module.IFloodlightService
;
import
net.floodlightcontroller.core.util.AppCookie
;
import
net.floodlightcontroller.packet.ARP
;
import
net.floodlightcontroller.packet.Ethernet
;
import
net.floodlightcontroller.packet.IPv4
;
import
net.floodlightcontroller.restserver.IRestApiService
;
...
...
@@ -61,6 +62,7 @@ public class VirtualNetworkFilter
protected
Map
<
String
,
String
>
nameToGuid
;
// Logical name -> Network ID
protected
Map
<
String
,
Integer
>
guidToGateway
;
// Network ID -> Gateway IP
protected
Map
<
Integer
,
Set
<
String
>>
gatewayToGuid
;
// Gateway IP -> Network ID
protected
Map
<
MACAddress
,
Integer
>
macToGateway
;
// Gateway MAC -> Gateway IP
protected
Map
<
MACAddress
,
String
>
macToGuid
;
// Host MAC -> Network ID
protected
Map
<
String
,
MACAddress
>
portToMac
;
// Host MAC -> logical port name
...
...
@@ -306,6 +308,26 @@ public class VirtualNetworkFilter
&&
isDefaultGatewayIp
(
srcNetwork
,
(
IPv4
)
eth
.
getPayload
()))
{
// or if the host is talking to the gateway continue
ret
=
Command
.
CONTINUE
;
}
else
if
(
eth
.
getPayload
()
instanceof
ARP
){
// We have to check here if it is an ARP reply from the default gateway
ARP
arp
=
(
ARP
)
eth
.
getPayload
();
if
(
arp
.
getProtocolType
()
!=
ARP
.
PROTO_TYPE_IP
)
{
ret
=
Command
.
CONTINUE
;
}
else
if
(
arp
.
getOpCode
()
==
ARP
.
OP_REPLY
)
{
int
ip
=
IPv4
.
toIPv4Address
(
arp
.
getSenderProtocolAddress
());
for
(
Integer
i
:
gatewayToGuid
.
keySet
())
{
if
(
i
.
intValue
()
==
ip
)
{
// Learn the default gateway MAC
macToGateway
.
put
(
new
MACAddress
(
arp
.
getSenderHardwareAddress
()),
ip
);
// Now we see if it's allowed for this packet
String
hostNet
=
macToGuid
.
get
(
new
MACAddress
(
eth
.
getDestinationMACAddress
()));
Set
<
String
>
gwGuids
=
gatewayToGuid
.
get
(
ip
);
if
((
gwGuids
!=
null
)
&&
(
gwGuids
.
contains
(
hostNet
)))
ret
=
Command
.
CONTINUE
;
break
;
}
}
}
}
if
(
ret
==
Command
.
CONTINUE
)
{
...
...
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