Skip to content

Commit

Permalink
fix: custom service match any port service
Browse files Browse the repository at this point in the history
  • Loading branch information
lzf575 committed Mar 4, 2025
1 parent 26b2716 commit ad8ce92
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/libs/grpc/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,20 @@ func (s *ServiceTable) QueryCustomService(epcID int32, isIPv6 bool, ipv4 uint32,
if len(s.customServiceIpv6Table) == 0 {
return 0
}
return s.customServiceIpv6Table[genEpcIDIPv6Key(epcID, ipv6, 0, serverPort)]
serviceID := s.customServiceIpv6Table[genEpcIDIPv6Key(epcID, ipv6, 0, serverPort)]
if serviceID > 0 || serverPort == 0 {
return serviceID
}
return s.customServiceIpv6Table[genEpcIDIPv6Key(epcID, ipv6, 0, 0)]
}
if len(s.customServiceIpv4Table) == 0 {
return 0
}
return s.customServiceIpv4Table[genEpcIDIPv4Key(epcID, ipv4, serverPort)]
serviceID := s.customServiceIpv4Table[genEpcIDIPv4Key(epcID, ipv4, serverPort)]
if serviceID > 0 || serverPort == 0 {
return serviceID
}
return s.customServiceIpv4Table[genEpcIDIPv4Key(epcID, ipv4, 0)]
}

func NewServiceTable(grpcServices []*trident.ServiceInfo) *ServiceTable {
Expand Down

0 comments on commit ad8ce92

Please sign in to comment.