Skip to content

Commit

Permalink
Sql use && instead of << to allow /32
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Aug 27, 2024
1 parent 2772023 commit d8ec6e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/database/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ DECLARE
BEGIN
SELECT uuid, action_next_hop, action_srh FROM rule
WHERE (rule.type_uplink = TRUE AND rule.enabled = TRUE
AND in_gnb_ip << rule.match_gnb_ip_prefix AND in_ue_ip_address << rule.match_ue_ip_prefix)
AND rule.match_gnb_ip_prefix && in_gnb_ip AND rule.match_ue_ip_prefix && in_ue_ip_address)
INTO var_uuid, out_action_next_hop, out_action_srh
LIMIT 1;
IF not FOUND THEN
Expand All @@ -118,7 +118,7 @@ BEGIN
RETURN QUERY SELECT rule.action_next_hop AS "t_action_next_hop", rule.action_srh AS "t_action_srh"
FROM rule
WHERE (rule.type_uplink = FALSE AND rule.enabled = TRUE
AND in_ue_ip_address << match_ue_ip_prefix);
AND match_ue_ip_prefix in_ue_ip_address);
END;$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION get_rule(
Expand Down
3 changes: 3 additions & 0 deletions internal/netfunc/headend-gtp4-ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (h HeadendGTP4WithCtrl) Handle(ctx context.Context, packet []byte) ([]byte,
return nil, ctx.Err()
default:
action, err = h.db.SetUplinkAction(ctx, teid, srgw_ip, gnb_ip, ue_ip_address)
if err != nil {
return nil, err
}
}

}
Expand Down

0 comments on commit d8ec6e0

Please sign in to comment.