Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarabdul3ziz committed Jan 15, 2025
1 parent ede0811 commit d0d84d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/network/nft/nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ func DropTrafficToLAN(namesapce string) error {
var buf bytes.Buffer
buf.WriteString("table inet filter {\n")
buf.WriteString(" chain forward {\n")
// allow traffic on sport ygg/myc discovery ports
buf.WriteString(" meta l4proto { tcp, udp } @th,0,16 { 9651, 9650 } accept;\n")
// allow traffic on dport ygg/myc discovery ports
buf.WriteString(" meta l4proto { tcp, udp } @th,16,16 { 9651, 9650 } accept;\n")
// allow traffic to the default gateway
buf.WriteString(fmt.Sprintf(" ip daddr %s accept;\n", ipAddr))
// allow traffic to any ip not in the network range
buf.WriteString(fmt.Sprintf(" ip daddr != %s accept;\n", netAddr))
// only drop traffic if it destined to mac addr other than the default gateway
buf.WriteString(fmt.Sprintf(" ether daddr != %s drop;\n", macAddr))
buf.WriteString(" }\n")
buf.WriteString("}\n")

// applied on the ndmz namespace
return Apply(&buf, namesapce)
}

Expand Down

0 comments on commit d0d84d8

Please sign in to comment.