Skip to content

Commit

Permalink
Filter disallowed outbound multicast
Browse files Browse the repository at this point in the history
To avoid DoS attacks, we should filter out disallowed outbound
multicast packets on the sending end, not just on the receiving end.
  • Loading branch information
danwinship committed Jan 27, 2017
1 parent 38603e0 commit 8ba9e66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/sdn/plugin/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,14 @@ func (plugin *OsdnNode) SetupSDN() (bool, error) {
// eg, "table=100, reg0=${tenant_id}, priority=2, ip, nw_dst=${external_cidr}, actions=drop
otx.AddFlow("table=100, priority=0, actions=output:2")

// Table 110: multicast delivery from local pods to the VXLAN; only one rule, updated by updateVXLANMulticastRules() in subnets.go
// eg, "table=110, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:${remote_node_ip_1}->tun_dst,output:1,set_field:${remote_node_ip_2}->tun_dst,output:1,goto_table:120"
// Table 110: outbound multicast filtering, updated by updateLocalMulticastFlows() in pod.go
// eg, "table=110, priority=100, reg0=${tenant_id}, actions=goto_table:111
otx.AddFlow("table=110, priority=0, actions=drop")

// Table 111: multicast delivery from local pods to the VXLAN; only one rule, updated by updateVXLANMulticastRules() in subnets.go
// eg, "table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:${remote_node_ip_1}->tun_dst,output:1,set_field:${remote_node_ip_2}->tun_dst,output:1,goto_table:120"
otx.AddFlow("table=111, priority=0, actions=drop")

// Table 120: multicast delivery to local pods (either from VXLAN or local pods); updated by updateLocalMulticastFlows() in pod.go
// eg, "table=120, priority=100, reg0=${tenant_id}, actions=output:${ovs_port_1},output:${ovs_port_2}"
otx.AddFlow("table=120, priority=0, actions=drop")
Expand Down
3 changes: 3 additions & 0 deletions pkg/sdn/plugin/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ func (m *podManager) updateLocalMulticastRulesWithLock(vnid uint32) {
otx := m.ovs.NewTransaction()
if m.policy.GetMulticastEnabled(vnid) {
outputs = localMulticastOutputs(m.runningPods, vnid)
otx.AddFlow("table=110, reg0=%d, actions=goto_table:111", vnid)
} else {
otx.DeleteFlows("table=110, reg0=%d", vnid)
}
if len(outputs) > 0 {
otx.AddFlow("table=120, priority=100, reg0=%d, actions=%s", vnid, outputs)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdn/plugin/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) {
tun_dsts += fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP)
}
}
otx.AddFlow("table=110, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)

if err := otx.EndTransaction(); err != nil {
log.Errorf("Error updating OVS VXLAN multicast flows: %v", err)
Expand Down

0 comments on commit 8ba9e66

Please sign in to comment.