fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42298?usp=email )
Change subject: enb_registry: fix addr/port filter logic (use andalso) ......................................................................
enb_registry: fix addr/port filter logic (use andalso)
In Erlang a function body returns only its last expression. The comma between the two enb_filter_by_sub_field/2 calls caused the result of the addr check to be silently discarded, so the filter only tested the port. Replace the comma with andalso to require both to match.
Change-Id: I8061636cd1077a4f3a9e9d37a31224f5e373becb --- M src/enb_registry.erl 1 file changed, 2 insertions(+), 2 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/enb_registry.erl b/src/enb_registry.erl index 29a2575..3c9e8ef 100644 --- a/src/enb_registry.erl +++ b/src/enb_registry.erl @@ -330,11 +330,11 @@ fun(_, Item) -> enb_filter_by_sub_field({mme_conn_info, mme_aid, Aid}, Item) end;
enb_filter({enb_addr_port, {Addr, Port}}) -> - fun(_, Item) -> enb_filter_by_sub_field({enb_conn_info, addr, Addr}, Item), + fun(_, Item) -> enb_filter_by_sub_field({enb_conn_info, addr, Addr}, Item) andalso enb_filter_by_sub_field({enb_conn_info, port, Port}, Item) end;
enb_filter({mme_addr_port, {Addr, Port}}) -> - fun(_, Item) -> enb_filter_by_sub_field({mme_conn_info, mme_addr, Addr}, Item), + fun(_, Item) -> enb_filter_by_sub_field({mme_conn_info, mme_addr, Addr}, Item) andalso enb_filter_by_sub_field({mme_conn_info, mme_port, Port}, Item) end;
enb_filter(Filter) ->