Potenziell: Problem mit führenden Nullen behoben
All checks were successful
build-binaries / build (, amd64, linux) (push) Has been skipped
build-binaries / build (, arm, 7, linux) (push) Has been skipped
build-binaries / build (, arm64, linux) (push) Has been skipped
build-binaries / build (.exe, amd64, windows) (push) Has been skipped
build-binaries / release (push) Has been skipped
release-tag / release-image (push) Successful in 2m27s
All checks were successful
build-binaries / build (, amd64, linux) (push) Has been skipped
build-binaries / build (, arm, 7, linux) (push) Has been skipped
build-binaries / build (, arm64, linux) (push) Has been skipped
build-binaries / build (.exe, amd64, windows) (push) Has been skipped
build-binaries / release (push) Has been skipped
release-tag / release-image (push) Successful in 2m27s
This commit is contained in:
27
main.go
27
main.go
@@ -216,11 +216,24 @@ func enabled(k string, def bool) bool {
|
||||
func DhcpHelperFunc(xHostname string, xDUIDs []string, xIAIDs []uint32) []payloadHelper {
|
||||
Ipv4Octets, _ := octetsRaw(pageIP) // evtl. pageIP nehmen?
|
||||
|
||||
// wandelt "00", "01", "09" -> "0", "1", "9"
|
||||
segment := func(s string) string {
|
||||
n, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
// Fallback: wenn es doch mal kein Zahlensring ist
|
||||
return "0"
|
||||
}
|
||||
return strconv.Itoa(n)
|
||||
}
|
||||
|
||||
rHostname := []rune(xHostname)
|
||||
if len(rHostname) < 6 { // 2+4
|
||||
fmt.Println("DhcpHelperFunc::1")
|
||||
qCalculatedIPv4 := Ipv4Octets[0] + "." + Ipv4Octets[1] + ".0.0"
|
||||
qCalculatedIPv6, _ := embedIPv4(qCalculatedIPv4)
|
||||
qCalculatedIPv6, qerr := embedIPv4(qCalculatedIPv4)
|
||||
if qerr != nil {
|
||||
fmt.Println(qerr)
|
||||
}
|
||||
return []payloadHelper{{
|
||||
Hostname: xHostname,
|
||||
DUID: firstOrEmpty(xDUIDs),
|
||||
@@ -233,13 +246,19 @@ func DhcpHelperFunc(xHostname string, xDUIDs []string, xIAIDs []uint32) []payloa
|
||||
IAID: "0",
|
||||
}}
|
||||
}
|
||||
|
||||
fmt.Println("DhcpHelperFunc::2")
|
||||
|
||||
qDUID := firstOrEmpty(xDUIDs)
|
||||
qSegment1 := string(rHostname[2:4])
|
||||
qSegment2 := string(rHostname[4:])
|
||||
qSegment1 := segment(string(rHostname[2:4]))
|
||||
qSegment2 := segment(string(rHostname[4:]))
|
||||
|
||||
qCalculatedIPv4 := Ipv4Octets[0] + "." + Ipv4Octets[1] + "." + qSegment1 + "." + qSegment2
|
||||
qCalculatedIPv6, _ := embedIPv4(qCalculatedIPv4)
|
||||
qCalculatedIPv6, qerr := embedIPv4(qCalculatedIPv4)
|
||||
if qerr != nil {
|
||||
fmt.Println(qerr)
|
||||
}
|
||||
|
||||
var res []payloadHelper
|
||||
for _, t := range xIAIDs {
|
||||
res = append(res, payloadHelper{
|
||||
|
||||
Reference in New Issue
Block a user