mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-16 03:46:52 +01:00
checkpt
This commit is contained in:
1 parent
027c728702
commit
e99e48cca7
7 files changed
+83
-77
No files matched your search
+7
-18
@@ -75,23 +75,8 @@ func addRulesFromConfig(l *slog.Logger, inbound bool, c *config.C, ra ruleAdder)
|
||||
sPort = r.Port
|
||||
}
|
||||
|
||||
var proto uint8
|
||||
switch r.Proto {
|
||||
case "any":
|
||||
proto = ProtoAny
|
||||
case "tcp":
|
||||
proto = iputil.IPProtocolTCP
|
||||
case "udp":
|
||||
proto = iputil.IPProtocolUDP
|
||||
case "udplite":
|
||||
proto = iputil.IPProtocolUDPLite
|
||||
case "dccp":
|
||||
proto = iputil.IPProtocolDCCP
|
||||
case "sctp":
|
||||
proto = iputil.IPProtocolSCTP
|
||||
case "icmp":
|
||||
proto = iputil.IPProtocolICMP
|
||||
default:
|
||||
proto, ok := protoByName(r.Proto)
|
||||
if !ok {
|
||||
// Any other protocol by number. 0 is reserved for `any`.
|
||||
n, perr := strconv.ParseUint(r.Proto, 10, 8)
|
||||
if perr != nil || n == 0 {
|
||||
@@ -99,9 +84,13 @@ func addRulesFromConfig(l *slog.Logger, inbound bool, c *config.C, ra ruleAdder)
|
||||
}
|
||||
proto = uint8(n)
|
||||
}
|
||||
// ICMPv6 rules are ICMP rules, see RulesBuilder.AddRule
|
||||
if proto == iputil.IPProtocolICMPv6 {
|
||||
proto = iputil.IPProtocolICMP
|
||||
}
|
||||
|
||||
var startPort, endPort int32
|
||||
if proto == iputil.IPProtocolICMP || proto == iputil.IPProtocolICMPv6 {
|
||||
if proto == iputil.IPProtocolICMP {
|
||||
startPort = PortAny
|
||||
endPort = PortAny
|
||||
if sPort != "" {
|
||||
|
||||
Reference in new issue
Block a user