diff --git a/config/config.yaml b/config/config.yaml index 6d53288..7c00601 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -22,9 +22,11 @@ uplink: downlink: - control-uri: "http://[fd00:0:0:0:2:8000:0:4]:8080" enabled: true + srgw_gtp4: "10.3.0.1" segments-list: - "fc00:1:1::/48" - control-uri: "http://[fd00:0:0:0:2:8000:0:5]:8080" enabled: true + srgw_gtp4: "10.3.0.1" segments-list: - "fc00:1:1::/48" diff --git a/go.mod b/go.mod index 0724c38..97fc746 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/gin-gonic/gin v1.10.0 github.com/gofrs/uuid v4.4.0+incompatible github.com/nextmn/go-pfcp-networking v0.0.42 - github.com/nextmn/json-api v0.0.16 + github.com/nextmn/json-api v0.0.17-0.20250117120523-f0c7cb4f9792 github.com/nextmn/logrus-formatter v0.0.1 github.com/nextmn/rfc9433 v0.0.2 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 7fa3ce3..bef2ea7 100644 --- a/go.sum +++ b/go.sum @@ -53,6 +53,10 @@ github.com/nextmn/go-pfcp-networking v0.0.42 h1:kYcGyIUMe/RVt3DpvDOKJt4+UbScIewD github.com/nextmn/go-pfcp-networking v0.0.42/go.mod h1:KYoKLiltDmHL2YMU5mz2k/E1xMoz4TpmzTz6Nr5u5gA= github.com/nextmn/json-api v0.0.16 h1:RU5eTVvnwrYK0Zmh/EhdO7Q3A+hUWjavg9ytJknaYTU= github.com/nextmn/json-api v0.0.16/go.mod h1:CQXeNPj9MDGsEExtnqJFIGjLgZAKsmOoO2fy+mep7Ak= +github.com/nextmn/json-api v0.0.17-0.20250117102021-8f2d7604eabc h1:WZg8N41u0VIeII/AS5U7aVjPCuGP+c3PdAd782xGxtI= +github.com/nextmn/json-api v0.0.17-0.20250117102021-8f2d7604eabc/go.mod h1:CQXeNPj9MDGsEExtnqJFIGjLgZAKsmOoO2fy+mep7Ak= +github.com/nextmn/json-api v0.0.17-0.20250117120523-f0c7cb4f9792 h1:eeigbuE6dbRFWl76iOvP+FgvLtkfgL7d0dRnGDgCJ5w= +github.com/nextmn/json-api v0.0.17-0.20250117120523-f0c7cb4f9792/go.mod h1:CQXeNPj9MDGsEExtnqJFIGjLgZAKsmOoO2fy+mep7Ak= github.com/nextmn/logrus-formatter v0.0.1 h1:Bsf78jjiEESc+rV8xE6IyKj4frDPGMwXFNrLQzm6A1E= github.com/nextmn/logrus-formatter v0.0.1/go.mod h1:vdSZ+sIcSna8vjbXkSFxsnsKHqRwaUEed4JCPcXoGyM= github.com/nextmn/rfc9433 v0.0.2 h1:6FjMY+Qy8MNXQ0PPxezUsyXDxJiCbTp5j3OcXQgIQh8= diff --git a/internal/app/rules-pusher.go b/internal/app/rules-pusher.go index 683cf4a..abdd9b0 100644 --- a/internal/app/rules-pusher.go +++ b/internal/app/rules-pusher.go @@ -130,7 +130,7 @@ func (pusher *RulesPusher) pushRTRRule(ctx context.Context, ue_ip string) error return nil // already pushed, nothing to do } infos.Pushed = true - service_ip := "10.4.0.1" + service_ip := "10.4.0.1" // FIXME: don't hardcode logrus.WithFields(logrus.Fields{ "ue-ip": ue_ip, "gnb-ip": infos.Gnb, @@ -234,7 +234,8 @@ func (pusher *RulesPusher) pushRTRRule(ctx context.Context, ue_ip string) error return err } action := n4tosrv6.Action{ - SRH: *srh, + SRH: *srh, + SourceGtp4: r.SrgwGtp4, } rule := n4tosrv6.Rule{ Enabled: true, diff --git a/internal/config/rule.go b/internal/config/rule.go index 7f22db8..345194a 100644 --- a/internal/config/rule.go +++ b/internal/config/rule.go @@ -15,5 +15,6 @@ type Rule struct { ControlURI jsonapi.ControlURI `yaml:"control-uri"` // e.g. http://srgw.local:8080 Area *[]netip.Prefix `yaml:"area,omitempty"` // list of gnbs in this area (can be aggregated in prefixes) Enabled bool `yaml:"enabled"` - SegmentsList []string `yaml:"segments-list"` // Segment[0] is the ultimate node, Segment[n-1] is the next hop ; Segment[0] can be a prefix (for downlink) + SegmentsList []string `yaml:"segments-list"` // Segment[0] is the ultimate node, Segment[n-1] is the next hop ; Segment[0] can be a prefix (for downlink) + SrgwGtp4 *netip.Addr `yaml:"srgw-gtp4,omitempty"` // GTP4 Address of the SRGW (for downlink rules only) }