Skip to content

Commit 8ba9e66

Browse files
committed
Filter disallowed outbound multicast
To avoid DoS attacks, we should filter out disallowed outbound multicast packets on the sending end, not just on the receiving end.
1 parent 38603e0 commit 8ba9e66

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

pkg/sdn/plugin/controller.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ func (plugin *OsdnNode) SetupSDN() (bool, error) {
313313
// eg, "table=100, reg0=${tenant_id}, priority=2, ip, nw_dst=${external_cidr}, actions=drop
314314
otx.AddFlow("table=100, priority=0, actions=output:2")
315315

316-
// Table 110: multicast delivery from local pods to the VXLAN; only one rule, updated by updateVXLANMulticastRules() in subnets.go
317-
// 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"
316+
// Table 110: outbound multicast filtering, updated by updateLocalMulticastFlows() in pod.go
317+
// eg, "table=110, priority=100, reg0=${tenant_id}, actions=goto_table:111
318318
otx.AddFlow("table=110, priority=0, actions=drop")
319319

320+
// Table 111: multicast delivery from local pods to the VXLAN; only one rule, updated by updateVXLANMulticastRules() in subnets.go
321+
// 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"
322+
otx.AddFlow("table=111, priority=0, actions=drop")
323+
320324
// Table 120: multicast delivery to local pods (either from VXLAN or local pods); updated by updateLocalMulticastFlows() in pod.go
321325
// eg, "table=120, priority=100, reg0=${tenant_id}, actions=output:${ovs_port_1},output:${ovs_port_2}"
322326
otx.AddFlow("table=120, priority=0, actions=drop")

pkg/sdn/plugin/pod.go

+3
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ func (m *podManager) updateLocalMulticastRulesWithLock(vnid uint32) {
209209
otx := m.ovs.NewTransaction()
210210
if m.policy.GetMulticastEnabled(vnid) {
211211
outputs = localMulticastOutputs(m.runningPods, vnid)
212+
otx.AddFlow("table=110, reg0=%d, actions=goto_table:111", vnid)
213+
} else {
214+
otx.DeleteFlows("table=110, reg0=%d", vnid)
212215
}
213216
if len(outputs) > 0 {
214217
otx.AddFlow("table=120, priority=100, reg0=%d, actions=%s", vnid, outputs)

pkg/sdn/plugin/subnets.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) {
272272
tun_dsts += fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP)
273273
}
274274
}
275-
otx.AddFlow("table=110, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)
275+
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts)
276276

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

0 commit comments

Comments
 (0)