lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

August 2023

  • 1 participants
  • 1514 discussions
[S] Change in osmo-ttcn3-hacks[master]: GTP_Templates: Add templates for RIM ROUTING ADDRESS
by dexter 09 Aug '23

09 Aug '23
Attention is currently required from: laforge, pespin. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34075 to look at the new patch set (#4). Change subject: GTP_Templates: Add templates for RIM ROUTING ADDRESS ...................................................................... GTP_Templates: Add templates for RIM ROUTING ADDRESS The IE types RIM_RoutingAddress and RIM_RoutingAddress_Discriminator have not coresponding templates yet. Related: OS#6095 Change-Id: If79f94ac3b7ec9a76763141ee2d8cac50c69d60b --- M library/GTP_Templates.ttcn 1 file changed, 39 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/75/34075/4 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: If79f94ac3b7ec9a76763141ee2d8cac50c69d60b Gerrit-Change-Number: 34075 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmo-msc[master]: trans_lcls_compose(): Set PLMN fron cell currently in use
by fixeria 08 Aug '23

08 Aug '23
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/33735 ) Change subject: trans_lcls_compose(): Set PLMN fron cell currently in use ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/33735 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Ibad0005a1d7cef64dd8fefa3e554ba99a06c3666 Gerrit-Change-Number: 33735 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 08 Aug 2023 19:48:03 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-msc[master]: Tx Loc UPD ACC: Use PLMN provided by subscr
by fixeria 08 Aug '23

08 Aug '23
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/33732 ) Change subject: Tx Loc UPD ACC: Use PLMN provided by subscr ...................................................................... Patch Set 2: Code-Review+1 (1 comment) Patchset: PS1: > as he's on holidays, maybe ping him explicitly if you expect any feedback during that time! Done -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/33732 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I421bd63a264db2bf6e1c4a4eea976f389e87b332 Gerrit-Change-Number: 33732 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 08 Aug 2023 19:46:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: socket: Add osmo_sock_init flag to enable SCTP ASCONF features
by pespin 08 Aug '23

08 Aug '23
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/34113 to look at the new patch set (#2). Change subject: socket: Add osmo_sock_init flag to enable SCTP ASCONF features ...................................................................... socket: Add osmo_sock_init flag to enable SCTP ASCONF features The SCTP_ASCONF_SUPPORTED sockopt, which enables ASCONF features for the SCTP associations managed by the SCTP socket, gets its default value from to sysctl "net.sctp.addip_enable", which, at least up to current kernel 6.4.8 is set to "0" (disabled) by default. As a result, ASCONF related features such as setsockopt(SCTP_SET_PEER_PRIMARY_ADDR) fail with -EPERM since ASNCONF extensions where not negotiated during the SCTP init handshake. This commit adds support for setting SCTP_ASCONF_SUPPORTED=1 during socket creation, since that needs to be applied before the first bind()/connect() (before first assoc is created). Furthermore, for ASCONF features to work properly, the assoc also needs to announce/use the AUTH extension, as per RFC5061 section 4.2.7. Otherwise, the peer receiving an SCTP INIT with ExtensionFeatures=ASCONF,ASCONF_ACK but without AUTH, will reject the assoc with an ABORT since it's not complying with spec (this behavior can be tweaked through sysctl "net.sctp.addip_noauth_enable"). The AUTH extension is enabled through sockopt SCTP_AUTH_SUPPORTED, and its default value is that of sysctl "net.sctp.auth_enable", which is also disabled (0) by default. Kernel support for those is relatively new: SCTP_FUTURE_ASSOC added in: 80df2704a375bb4b3c9c5cce9c00052361b16d61 Follows: v5.0-rc4 Precedes: v5.1-rc1 SCTP_ASCONF_SUPPORTED added in: df2c71ffdfae58961981d7cbcccea93688fc4e96 Follows: v5.3-rc5 Precedes: v5.4-rc1 SCTP_AUTH_SUPPORTED added in: 56dd525abd56f7acd7b44a52935726e3ada4916c Follows: v5.3-rc5 Precedes: v5.4-rc1 Related: OS#6076 Change-Id: Iac07031927b66a9d32d2bb2faab817e4c922a359 --- M include/osmocom/core/socket.h M src/core/socket.c 2 files changed, 101 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/34113/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34113 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iac07031927b66a9d32d2bb2faab817e4c922a359 Gerrit-Change-Number: 34113 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in libosmo-sccp[master]: asp: Allow setting IP address as SCTP primary upon conn establishment
by pespin 08 Aug '23

08 Aug '23
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 to look at the new patch set (#3). Change subject: asp: Allow setting IP address as SCTP primary upon conn establishment ...................................................................... asp: Allow setting IP address as SCTP primary upon conn establishment This is an initial implementation to set the local SCTP Primary address as well as the peer's Primary Address (through SCTP ASCONF messages). The Primary address is only set upon conn establishment (after connect() for clients, or accept() for severs), which means no logic is introduced to make sure that primary address is kept during the entire operation of the SCTP association (for instance if the Primary address becomes unavailable and the stack changes the primary, and later on that address becomes available again, the primary addres won't be set back to the initially configured one). Related: OS#6076 Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca --- M TODO-RELEASE M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c M src/osmo_ss7_vty.c M tests/vty/ss7_asp_test.vty 5 files changed, 317 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/11/34111/3 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca Gerrit-Change-Number: 34111 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in libosmo-netif[master]: stream: Use new flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED for SCTP sockets
by pespin 08 Aug '23

08 Aug '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/34114 ) Change subject: stream: Use new flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED for SCTP sockets ...................................................................... stream: Use new flag OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED for SCTP sockets This is required if the user of the stream API wants to use SCTP extra features such as setting the Peer Primary Address through ASCONF. At a later point we may want to add new osmo_stream APIs to set extra flags for the socket, or maybe simply add a new API specifically to enable ASCONF for the stream. Depends: libosmocore.git Change-Id Iac07031927b66a9d32d2bb2faab817e4c922a359 Related: OS#6076 Change-Id: I807b3748b8535d8e75ceea812d7baaf153fa1d60 --- M src/stream_cli.c M src/stream_srv.c 2 files changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/14/34114/1 diff --git a/src/stream_cli.c b/src/stream_cli.c index d7d6b90..70e4890 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -747,7 +747,7 @@ ret = osmo_sock_init2_multiaddr(AF_UNSPEC, SOCK_STREAM, cli->proto, (const char **)cli->local_addr, cli->local_addrcnt, cli->local_port, (const char **)cli->addr, cli->addrcnt, cli->port, - OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); + OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED); break; #endif default: @@ -826,7 +826,7 @@ ret = osmo_sock_init2_multiaddr(cli->sk_domain, cli->sk_type, cli->proto, (const char **)cli->local_addr, cli->local_addrcnt, cli->local_port, (const char **)cli->addr, cli->addrcnt, cli->port, - OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); + OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED); break; #endif default: diff --git a/src/stream_srv.c b/src/stream_srv.c index 17925af..c8d3233 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -411,7 +411,7 @@ case IPPROTO_SCTP: ret = osmo_sock_init2_multiaddr(link->sk_domain, link->sk_type, link->proto, (const char **)link->addr, link->addrcnt, link->port, - NULL, 0, 0, OSMO_SOCK_F_BIND); + NULL, 0, 0, OSMO_SOCK_F_BIND|OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED); break; #endif default: -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34114 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I807b3748b8535d8e75ceea812d7baaf153fa1d60 Gerrit-Change-Number: 34114 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmocore[master]: socket: Add osmo_sock_init flag to enable SCTP ASCONF features
by pespin 08 Aug '23

08 Aug '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/34113 ) Change subject: socket: Add osmo_sock_init flag to enable SCTP ASCONF features ...................................................................... socket: Add osmo_sock_init flag to enable SCTP ASCONF features The SCTP_ASCONF_SUPPORTED sockopt, which enables ASCONF features for the SCTP associations managed by the SCTP socket, gets its default value from to sysctl "net.sctp.addip_enable", which, at least up to current kernel 6.4.8 is set to "0" (disabled) by default. As a result, ASCONF related features such as setsockopt(SCTP_SET_PEER_PRIMARY_ADDR) fail with -EPERM since ASNCONF extensions where not negotiated during the SCTP init handshake. This commit adds support for setting SCTP_ASCONF_SUPPORTED=1 during socket creation, since that needs to be applied before the first bind()/connect() (before first assoc is created). Furthermore, for ASCONF features to work properly, the assoc also needs to announce/use the AUTH extension, as per RFC5061 section 4.2.7. Otherwise, the peer receiving an SCTP INIT with ExtensionFeatures=ASCONF,ASCONF_ACK but without AUTH, will reject the assoc with an ABORT since it's not complying with spec (this behavior can be tweaked through sysctl "net.sctp.addip_noauth_enable"). The AUTH extension is enabled through sockopt SCTP_AUTH_SUPPORTED, and its default value is that of sysctl "net.sctp.auth_enable", which is also disabled (0) by default. Related: OS#6076 Change-Id: Iac07031927b66a9d32d2bb2faab817e4c922a359 --- M include/osmocom/core/socket.h M src/core/socket.c 2 files changed, 63 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/34113/1 diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index 6bac87d..c68bb6f 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -94,6 +94,8 @@ #define OSMO_SOCK_F_NO_MCAST_ALL (1 << 4) /*! use SO_REUSEADDR on UDP ports (required for multicast) */ #define OSMO_SOCK_F_UDP_REUSEADDR (1 << 5) +/*! use SCTP_AUTH_SUPPORTED + SCTP_ASCONF_SUPPORTED on SCTP socket (required for ASCONF / Peer Primary Address feature) */ +#define OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED (1 << 6) /*! use OSMO_SOCK_F_DSCP(x) to set IP DSCP 'x' for packets transmitted on the socket */ #define OSMO_SOCK_F_DSCP(x) (((x)&0x3f) << 24) diff --git a/src/core/socket.c b/src/core/socket.c index 5a31c8f..66f903e 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -811,6 +811,34 @@ goto ret_close; } + if (flags & OSMO_SOCK_F_SCTP_ASCONF_SUPPORTED) { + struct sctp_assoc_value assoc_val = { + .assoc_id = SCTP_FUTURE_ASSOC, + .assoc_value = 1, + }; + /* RFC 5061 4.2.7: ASCONF also requires AUTH feature. */ + rc = setsockopt(sfd, IPPROTO_SCTP, SCTP_AUTH_SUPPORTED, + &assoc_val, sizeof(assoc_val)); + if (rc < 0) { + int err = errno; + multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt); + LOGP(DLGLOBAL, LOGL_ERROR, + "cannot setsockopt(SCTP_AUTH_SUPPORTED) socket: %s:%u: %s\n", + strbuf, local_port, strerror(err)); + goto ret_close; + } + rc = setsockopt(sfd, IPPROTO_SCTP, SCTP_ASCONF_SUPPORTED, + &assoc_val, sizeof(assoc_val)); + if (rc < 0) { + int err = errno; + multiaddr_snprintf(strbuf, sizeof(strbuf), local_hosts, local_hosts_cnt); + LOGP(DLGLOBAL, LOGL_ERROR, + "cannot setsockopt(SCTP_ASCONF_SUPPORTED) socket: %s:%u: %s\n", + strbuf, local_port, strerror(err)); + goto ret_close; + } + } + /* Build array of addresses taking first entry for each host. TODO: Ideally we should use backtracking storing last used indexes and trying next combination if connect() fails .*/ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34113 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iac07031927b66a9d32d2bb2faab817e4c922a359 Gerrit-Change-Number: 34113 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in libosmo-sccp[master]: asp: Allow setting IP address as SCTP primary upon conn establishment
by pespin 08 Aug '23

08 Aug '23
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 to look at the new patch set (#2). Change subject: asp: Allow setting IP address as SCTP primary upon conn establishment ...................................................................... asp: Allow setting IP address as SCTP primary upon conn establishment This is an initial implementation to set the local SCTP Primary address as well as the peer's Primary Address (through SCTP ASCONF messages). The Primary address is only set upon conn establishment (after connect() for clients, or accept() for severs), which means no logic is introduced to make sure that primary address is kept during the entire operation of the SCTP association (for instance if the Primary address becomes unavailable and the stack changes the primary, and later on that address becomes available again, the primary addres won't be set back to the initially configured one). Related: OS#6076 Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca --- M TODO-RELEASE M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c M src/osmo_ss7_vty.c M tests/vty/ss7_asp_test.vty 5 files changed, 358 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/11/34111/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca Gerrit-Change-Number: 34111 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in libosmo-sccp[master]: asp: Monitor SCTP_PEER_ADDR_CHANGE events to re-apply configured Prim...
by pespin 08 Aug '23

08 Aug '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/34112 ) Change subject: asp: Monitor SCTP_PEER_ADDR_CHANGE events to re-apply configured Primary Address ...................................................................... asp: Monitor SCTP_PEER_ADDR_CHANGE events to re-apply configured Primary Address The kernel doesn't store state about a "always-preferred" Primary address, it simply applies the requested one at the time the request is done. If afterwards the remote address becomes unavailable, the kernel will end up giving up on it and selecting anoter one as primary address. If the VTY-configured Primary Address become available after a while (signaled by the kernel in the SCTP_PEER_ADDR_CHANGE), make sure to apply it again. Similary, if the peer sends us an ASCONF changing our Primary Address, we should discard that and apply/overwrite *iff* the user explicitly VTY-configured one (kernel announces the change through SCTP_ADDR_MADE_PRIM in this scenario). Related: OS#6076 Change-Id: I2e54e6f9e424350474db6dec6ab604b33a03f88b --- M src/osmo_ss7.c 1 file changed, 106 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/12/34112/1 diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 68b4559..fadab9e 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1478,6 +1478,86 @@ return rc; } +static void asp_handle_sctp_notif_monitor_primary_address(const struct osmo_ss7_asp *asp, + const union sctp_notification *notif) +{ + const char *primary_str; + int primary_str_type; + struct osmo_sockaddr ev_addr, primary; + + if (asp->cfg.remote.idx_primary == -1) + return; + if (notif->sn_header.sn_type != SCTP_PEER_ADDR_CHANGE) + return; + + primary_str = asp->cfg.remote.host[asp->cfg.remote.idx_primary]; + primary_str_type = osmo_ip_str_type(primary_str); + memcpy(&ev_addr.u.sas, &notif->sn_paddr_change.spc_aaddr, sizeof(ev_addr.u.sas)); + + switch (notif->sn_paddr_change.spc_state) { + case SCTP_ADDR_AVAILABLE: + case SCTP_ADDR_ADDED: + case SCTP_ADDR_CONFIRMED: + /* If our primary addr is made available/added/confirmed, set it */ + /* This whole switch is to properly compare addresses (take into account v6mapped IPv4 addresses): */ + switch (ev_addr.u.sa.sa_family) { + case AF_INET: + switch (primary_str_type) { + case AF_INET: + primary = ev_addr; /* Copy AF + port */ + inet_pton(AF_INET, primary_str, &primary.u.sin.sin_addr); + if (osmo_sockaddr_cmp(&primary, &ev_addr) == 0) + asp_apply_primary_address(asp); + case AF_INET6: + /* for sure not the same, nothing to do. */ + return; + } + return; + case AF_INET6: + /* "ev_addr" can either be a IPv6 addr or a v6-mapped IPv4 + * address. Compare both as IPv6 (or v6-mapped IPv4) addresses. */ + primary = ev_addr; /* Copy AF + port */ + inet_pton(AF_INET6, primary_str, &primary.u.sin6.sin6_addr); + if (osmo_sockaddr_cmp(&primary, &ev_addr) == 0) + asp_apply_primary_address(asp); + return; + default: + return; + } + break; + case SCTP_ADDR_MADE_PRIM: + /* If anoter primary addr is made primary, overwrite it by setting it again */ + /* This whole switch is to properly compare addresses (take into account v6mapped IPv4 addresses): */ + switch (ev_addr.u.sa.sa_family) { + case AF_INET: + switch (primary_str_type) { + case AF_INET: + primary = ev_addr; /* Copy AF + port */ + inet_pton(AF_INET, primary_str, &primary.u.sin.sin_addr); + if (osmo_sockaddr_cmp(&primary, &ev_addr) != 0) + asp_apply_primary_address(asp); + case AF_INET6: + /* for sure not the same, apply primary address: */ + asp_apply_primary_address(asp); + return; + } + return; + case AF_INET6: + /* "ev_addr" can either be a IPv6 addr or a v6-mapped IPv4 + * address. Compare both as IPv6 (or v6-mapped IPv4) addresses. */ + primary = ev_addr; /* Copy AF + port */ + inet_pton(AF_INET6, primary_str, &primary.u.sin6.sin6_addr); + if (osmo_sockaddr_cmp(&primary, &ev_addr) != 0) + asp_apply_primary_address(asp); + return; + default: + return; + } + default: + break; + } +} + static bool ipv6_sctp_supported(const char *host, bool bind) { int rc; @@ -2001,6 +2081,7 @@ if (flags & OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION) { union sctp_notification *notif = (union sctp_notification *) msgb_data(msg); log_sctp_notification(asp, "xUA CLNT", notif); + asp_handle_sctp_notif_monitor_primary_address(asp, notif); switch (notif->sn_header.sn_type) { case SCTP_ASSOC_CHANGE: @@ -2147,6 +2228,7 @@ if (flags & OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION) { union sctp_notification *notif = (union sctp_notification *) msgb_data(msg); log_sctp_notification(asp, "xUA CLNT", notif); + asp_handle_sctp_notif_monitor_primary_address(asp, notif); switch (notif->sn_header.sn_type) { case SCTP_ASSOC_CHANGE: -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34112 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I2e54e6f9e424350474db6dec6ab604b33a03f88b Gerrit-Change-Number: 34112 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in libosmo-sccp[master]: asp: Allow setting IP address as SCTP primary upon conn establishment
by pespin 08 Aug '23

08 Aug '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 ) Change subject: asp: Allow setting IP address as SCTP primary upon conn establishment ...................................................................... asp: Allow setting IP address as SCTP primary upon conn establishment This is an initial implementation to set the local SCTP Primary address as well as the peer's Primary Address (through SCTP ASCONF messages). The Primary address is only set upon conn establishment (after connect() for clients, or accept() for severs), which means no logic is introduced to make sure that primary address is kept during the entire operation of the SCTP association (for instance if the Primary address becomes unavailable and the stack changes the primary, and later on that address becomes available again, the primary addres won't be set back to the initially configured one). Related: OS#6076 Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca --- M TODO-RELEASE M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c M src/osmo_ss7_vty.c M tests/vty/ss7_asp_test.vty 5 files changed, 311 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/11/34111/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 753e24a..306eed9 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -12,3 +12,4 @@ libosmo-sccp add API osmo_ss7_asp_get_name(), osmo_ss7_asp_get_proto() osmo_sccp_simple_client_on_ss7_id() behavior change: ASPs asp-clnt-* defined through VTY must explicitly configure "role" and "sctp-role" libosmo-netif > 1.3.0 flag OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION set by osmo_stream_cli_recv() +libosmo-sccp add API osmo_ss7_asp_peer_init(), osmo_ss7_asp_peer_set_hosts2(), osmo_ss7_asp_peer_add_host2() diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 1197ddf..ed3d409 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -366,6 +366,8 @@ char *host[OSMO_SOCK_MAX_ADDRS]; size_t host_cnt; uint16_t port; + /* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */ + int idx_primary; }; enum osmo_ss7_asp_admin_state { @@ -451,9 +453,13 @@ #define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE 0x00000004 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer); +void osmo_ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer); int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const*hosts, size_t host_cnt); +int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, + const char *const*hosts, size_t host_cnt, int idx_primary); int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host); +int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr); struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name); diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 5befdee..68b4559 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -125,6 +125,59 @@ return -1; } +static int _setsockopt_peer_primary_addr(int fd, const struct osmo_sockaddr *saddr) +{ + int rc; + + struct sctp_setpeerprim so_sctp_setpeerprim = {0}; + + /* rfc6458 sec 8: "For the one-to-one style sockets and branched-off one-to-many + * style sockets (see Section 9.2), this association ID parameter is ignored" + */ + + /* NOTE: Requires setting: + * - sysctl net.sctp.addip_enable = 1, otherwise EPERM is returned + * - sysctl net.sctp.auth_enable = 1, RFC 5061 4.2.7 "An implementation supporting this + * extension MUST list the ASCONF,the ASCONF-ACK, and the AUTH chunks in + * its INIT and INIT-ACK parameters." + */ + + so_sctp_setpeerprim.sspp_addr = saddr->u.sas; + rc = setsockopt(fd, IPPROTO_SCTP, SCTP_SET_PEER_PRIMARY_ADDR, + &so_sctp_setpeerprim, sizeof(so_sctp_setpeerprim)); + if (rc < 0) { + char buf[128]; + int err = errno; + strerror_r(err, (char *)buf, sizeof(buf)); + LOGP(DLSS7, LOGL_ERROR, "setsockopt(SCTP_SET_PEER_PRIMARY_ADDR, %s) failed: %s%s\n", + osmo_sockaddr_to_str(saddr), buf, + err == EPERM ? " (EPERM: Make sure you have sysctl 'net.sctp.auth_enable' " + "and 'net.sctp.addip_enable' set to 1)" : ""); + } + return rc; +} + +static int _setsockopt_primary_addr(int fd, const struct osmo_sockaddr *saddr) +{ + int rc; + + struct sctp_prim so_sctp_prim = {0}; + + /* rfc6458 sec 8: "For the one-to-one style sockets and branched-off one-to-many + * style sockets (see Section 9.2), this association ID parameter is ignored" + */ + + so_sctp_prim.ssp_addr = saddr->u.sas; + rc = setsockopt(fd, IPPROTO_SCTP, SCTP_PRIMARY_ADDR, + &so_sctp_prim, sizeof(so_sctp_prim)); + if (rc < 0) { + char buf[128]; + strerror_r(errno, (char *)buf, sizeof(buf)); + LOGP(DLSS7, LOGL_ERROR, "setsockopt(SCTP_PRIMARY_ADDR, %s) failed: %s\n", + osmo_sockaddr_to_str(saddr), buf); + } + return rc; +} /*********************************************************************** * SS7 Point Code Parsing / Printing @@ -1179,11 +1232,18 @@ }; static unsigned int g_ss7_asp_rcg_idx; +void osmo_ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer) +{ + memset(peer, 0, sizeof(*peer)); + peer->idx_primary = -1; +} + int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer) { int len = 0, offset = 0, rem = buf_len; int ret, i; char *after; + char *primary; if (buf_len < 3) return -EINVAL; @@ -1195,11 +1255,12 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } for (i = 0; i < peer->host_cnt; i++) { + primary = (peer->idx_primary == i) ? "*" : ""; if (peer->host_cnt == 1) after = ""; else after = (i == (peer->host_cnt - 1)) ? ")" : "|"; - ret = snprintf(buf + offset, rem, "%s%s", peer->host[i] ? : "0.0.0.0", after); + ret = snprintf(buf + offset, rem, "%s%s%s", peer->host[i] ? : "0.0.0.0", primary, after); OSMO_SNPRINTF_RET(ret, rem, offset, len); } ret = snprintf(buf + offset, rem, ":%u", peer->port); @@ -1215,11 +1276,15 @@ * \param[in] talloc_ctx talloc context used to allocate new addresses. * \param[in] hosts Array of strings containing IP addresses. * \param[in] host_cnt Number of strings in hosts + * \param[in] idx_primary Index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set * \returns 0 on success; negative otherwise */ -int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const*hosts, size_t host_cnt) +int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const*hosts, size_t host_cnt, int idx_primary) { int i = 0; + if (idx_primary >= (int)host_cnt) + return -EINVAL; + if (host_cnt > ARRAY_SIZE(peer->host)) return -EINVAL; @@ -1231,9 +1296,21 @@ } peer->host_cnt = host_cnt; + peer->idx_primary = idx_primary; return 0; } +/*! \brief Set (copy) addresses for a given ASP peer. Previous addresses are freed. + * \param[in] peer Application Server Process peer whose addresses are to be set. + * \param[in] talloc_ctx talloc context used to allocate new addresses. + * \param[in] hosts Array of strings containing IP addresses. + * \param[in] host_cnt Number of strings in hosts + * \returns 0 on success; negative otherwise */ +int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const*hosts, size_t host_cnt) +{ + return osmo_ss7_asp_peer_set_hosts2(peer, talloc_ctx, hosts, host_cnt, -1); +} + /* Is string formatted IPv4/v6 addr considered IN(6)ADDR_ANY? */ static inline bool host_is_ip_anyaddr(const char *host, bool is_v6) { @@ -1248,37 +1325,159 @@ * \param[in] peer Application Server Process peer the address is appended to. * \param[in] talloc_ctx talloc context used to allocate new address. * \param[in] host string containing an IP addresses. + * \param[in] is_primary_addr whether this IP address is to be added as SCTP Primary Address * \returns 0 on success; negative otherwise */ -int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host) +int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, + const char *host, bool is_primary_addr) { int i; bool new_is_v6 = osmo_ip_str_type(host) == AF_INET6; bool new_is_any = host_is_ip_anyaddr(host, new_is_v6); - bool iter_is_v6; + struct osmo_sockaddr_str addr_str; + + if (osmo_sockaddr_str_from_str(&addr_str, host, 0) < 0) + return -EINVAL; + + if (new_is_any) { + /* Makes no sense to have INET(6)_ANY many times, or INET(6)_ANY + * together with specific addresses, be it of same or different + * IP version: */ + if (peer->host_cnt != 0) + return -EINVAL; + + /* Makes no sense to have INET(6)_ANY as primary: */ + if (is_primary_addr) + return -EINVAL; + + if (peer->host_cnt >= ARRAY_SIZE(peer->host)) + return -EINVAL; + osmo_talloc_replace_string(talloc_ctx, &peer->host[peer->host_cnt], host); + peer->host_cnt++; + return 0; + } + + /* Makes no sense to add specific address to set if INET(6)_ANY + * is already set, be it from same or different IP version: */ + for (i = 0; i < peer->host_cnt; i++) { + bool iter_is_v6 = osmo_ip_str_type(peer->host[i]) == AF_INET6; + if (host_is_ip_anyaddr(peer->host[i], iter_is_v6)) + return -EINVAL; + } + /* Reached this point, no INET(6)_ANY address is set nor we are adding an INET(6)_ANY address. */ + + /* Check if address already exists, and then if primary flags need to be changed: */ + for (i = 0; i < peer->host_cnt; i++) { + struct osmo_sockaddr_str it_addr_str; + bool it_is_primary; + osmo_sockaddr_str_from_str(&it_addr_str, peer->host[i], 0); + + if (osmo_sockaddr_str_cmp(&addr_str, &it_addr_str) != 0) + continue; + it_is_primary = (peer->idx_primary == i); + if (is_primary_addr == it_is_primary) { + /* Nothing to do, return below */ + } else if (is_primary_addr && !it_is_primary) { + /* Mark it as primary: */ + peer->idx_primary = i; + } else { /* if (!is_primary && it_is_primary) { */ + /* mark it as non-primary: */ + peer->idx_primary = -1; + } + return 0; + } if (peer->host_cnt >= ARRAY_SIZE(peer->host)) return -EINVAL; - /* Makes no sense to have INET(6)_ANY many times, or INET(6)_ANY - together with specific addresses, be it of same or different - IP version:*/ - if (new_is_any && peer->host_cnt != 0) - return -EINVAL; - - if (!new_is_any) { - /* Makes no sense to add specific address to set if INET(6)_ANY - is already set, be it from same or different IP version: */ - for (i = 0; i < peer->host_cnt; i++) { - iter_is_v6 = osmo_ip_str_type(peer->host[i]) == AF_INET6; - if (host_is_ip_anyaddr(peer->host[i], iter_is_v6)) - return -EINVAL; - } - } osmo_talloc_replace_string(talloc_ctx, &peer->host[peer->host_cnt], host); + if (is_primary_addr) + peer->idx_primary = peer->host_cnt; peer->host_cnt++; return 0; } +/*! \brief Append (copy) address to a given ASP peer. Previous addresses are kept. + * \param[in] peer Application Server Process peer the address is appended to. + * \param[in] talloc_ctx talloc context used to allocate new address. + * \param[in] host string containing an IP addresses. + * \returns 0 on success; negative otherwise */ +int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, + const char *host) +{ + return osmo_ss7_asp_peer_add_host2(peer, talloc_ctx, host, false); +} + +static int asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp) +{ + struct osmo_fd *ofd; + struct osmo_sockaddr_str addr_str; + struct osmo_sockaddr addr; + uint16_t local_port; + int rc; + + /* No SCTP Peer Primary Address explicitly configured, do nothing. */ + if (asp->cfg.local.idx_primary == -1) + return 0; + OSMO_ASSERT(asp->cfg.local.idx_primary < asp->cfg.local.host_cnt); + + if (asp->cfg.is_server) + ofd = osmo_stream_srv_get_ofd(asp->server); + else + ofd = osmo_stream_cli_get_ofd(asp->client); + + if (asp->cfg.local.port == 0) { + char port_buf[16]; + osmo_sock_get_local_ip_port(ofd->fd, port_buf, sizeof(port_buf)); + local_port = atoi(port_buf); + } else { + local_port = asp->cfg.local.port; + } + rc = osmo_sockaddr_str_from_str(&addr_str, + asp->cfg.local.host[asp->cfg.local.idx_primary], + local_port); + if (rc < 0) + return rc; + rc = osmo_sockaddr_str_to_sockaddr(&addr_str, &addr.u.sas); + if (rc < 0) + return rc; + LOGPASP(asp, DLSS7, LOGL_INFO, "Set Peer's Primary Address %s\n", + osmo_sockaddr_to_str(&addr)); + rc = _setsockopt_peer_primary_addr(ofd->fd, &addr); + + return rc; +} + +static int asp_apply_primary_address(const struct osmo_ss7_asp *asp) +{ + struct osmo_fd *ofd; + struct osmo_sockaddr_str addr_str; + struct osmo_sockaddr addr; + int rc; + + /* No SCTP Primary Address explicitly configured, do nothing. */ + if (asp->cfg.remote.idx_primary == -1) + return 0; + OSMO_ASSERT(asp->cfg.remote.idx_primary < asp->cfg.remote.host_cnt); + + if (asp->cfg.is_server) + ofd = osmo_stream_srv_get_ofd(asp->server); + else + ofd = osmo_stream_cli_get_ofd(asp->client); + + rc = osmo_sockaddr_str_from_str(&addr_str, + asp->cfg.remote.host[asp->cfg.remote.idx_primary], + asp->cfg.remote.port); + if (rc < 0) + return rc; + rc = osmo_sockaddr_str_to_sockaddr(&addr_str, &addr.u.sas); + if (rc < 0) + return rc; + LOGPASP(asp, DLSS7, LOGL_INFO, "Set Primary Address %s\n", + osmo_sockaddr_to_str(&addr)); + rc = _setsockopt_primary_addr(ofd->fd, &addr); + return rc; +} + static bool ipv6_sctp_supported(const char *host, bool bind) { int rc; @@ -1534,7 +1733,9 @@ } rate_ctr_group_set_name(asp->ctrg, name); asp->inst = inst; + osmo_ss7_asp_peer_init(&asp->cfg.remote); asp->cfg.remote.port = remote_port; + osmo_ss7_asp_peer_init(&asp->cfg.local); asp->cfg.local.port = local_port; asp->cfg.proto = proto; asp->cfg.name = talloc_strdup(asp, name); @@ -1849,6 +2050,7 @@ { struct osmo_fd *ofd = osmo_stream_cli_get_ofd(cli); struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(cli); + int rc = 0; /* update the socket name */ talloc_free(asp->sock_name); @@ -1856,6 +2058,15 @@ LOGPASP(asp, DLSS7, LOGL_INFO, "Client connected %s\n", asp->sock_name); + /* Now that we have the conn in place, the local/remote addresses are + * fed and the local port is known for sure. Apply SCTP Primary addresses + * if needed: + */ + if (asp->cfg.proto != OSMO_SS7_ASP_PROT_IPA) { + rc = asp_apply_peer_primary_address(asp); + rc = asp_apply_primary_address(asp); + } + if (asp->lm && asp->lm->prim_cb) { /* Notify layer manager that a connection has been * established */ @@ -1865,7 +2076,7 @@ osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_M_ASP_UP_REQ, NULL); } - return 0; + return rc; } static void xua_cli_close(struct osmo_stream_cli *cli) @@ -2016,6 +2227,7 @@ struct osmo_ss7_asp *asp; char *sock_name = osmo_sock_get_name(link, fd); const char *proto_name = get_value_string(osmo_ss7_asp_protocol_vals, oxs->cfg.proto); + int rc = 0; LOGP(DLSS7, LOGL_INFO, "%s: New %s connection accepted\n", sock_name, proto_name); @@ -2105,11 +2317,16 @@ * data */ osmo_stream_srv_set_data(srv, asp); + if (oxs->cfg.proto != OSMO_SS7_ASP_PROT_IPA) { + rc = asp_apply_peer_primary_address(asp); + rc = asp_apply_primary_address(asp); + } + /* send M-SCTP_ESTABLISH.ind to Layer Manager */ osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_EST_IND, 0); xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_ESTABLISH, PRIM_OP_INDICATION); - return 0; + return rc; } /*! \brief send a fully encoded msgb via a given ASP diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 61f14cd..bf98d4b 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -656,14 +656,15 @@ } DEFUN_ATTR(asp_local_ip, asp_local_ip_cmd, - "local-ip " VTY_IPV46_CMD, + "local-ip " VTY_IPV46_CMD " [primary]", "Specify Local IP Address from which to contact ASP\n" "Local IPv4 Address from which to contact of ASP\n" - "Local IPv6 Address from which to contact of ASP\n", + "Local IPv6 Address from which to contact of ASP\n" + "Signal the SCTP peer to use this address as Primary Address\n", CMD_ATTR_NODE_EXIT) { struct osmo_ss7_asp *asp = vty->index; - if (osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, argv[0]) != 0) { + if (osmo_ss7_asp_peer_add_host2(&asp->cfg.local, asp, argv[0], argc > 1) != 0) { vty_out(vty, "%% Failed adding host '%s' to set%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -671,14 +672,15 @@ } DEFUN_ATTR(asp_remote_ip, asp_remote_ip_cmd, - "remote-ip " VTY_IPV46_CMD, + "remote-ip " VTY_IPV46_CMD " [primary]", "Specify Remote IP Address of ASP\n" "Remote IPv4 Address of ASP\n" - "Remote IPv6 Address of ASP\n", + "Remote IPv6 Address of ASP\n" + "Set remote address as SCTP Primary Address\n", CMD_ATTR_NODE_EXIT) { struct osmo_ss7_asp *asp = vty->index; - if (osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, argv[0]) != 0) { + if (osmo_ss7_asp_peer_add_host2(&asp->cfg.remote, asp, argv[0], argc > 1) != 0) { vty_out(vty, "%% Failed adding host '%s' to set%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -937,11 +939,13 @@ vty_out(vty, " description %s%s", asp->cfg.description, VTY_NEWLINE); for (i = 0; i < asp->cfg.local.host_cnt; i++) { if (asp->cfg.local.host[i]) - vty_out(vty, " local-ip %s%s", asp->cfg.local.host[i], VTY_NEWLINE); + vty_out(vty, " local-ip %s%s%s", asp->cfg.local.host[i], + asp->cfg.local.idx_primary == i ? " primary" : "", VTY_NEWLINE); } for (i = 0; i < asp->cfg.remote.host_cnt; i++) { if (asp->cfg.remote.host[i]) - vty_out(vty, " remote-ip %s%s", asp->cfg.remote.host[i], VTY_NEWLINE); + vty_out(vty, " remote-ip %s%s%s", asp->cfg.remote.host[i], + asp->cfg.remote.idx_primary == i ? " primary" : "", VTY_NEWLINE); } if (asp->cfg.qos_class) vty_out(vty, " qos-class %u%s", asp->cfg.qos_class, VTY_NEWLINE); diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty index 3296c65..04c28b1 100644 --- a/tests/vty/ss7_asp_test.vty +++ b/tests/vty/ss7_asp_test.vty @@ -220,8 +220,8 @@ ss7_asp_vty_test(config-cs7-asp)# list ... description .TEXT - remote-ip (A.B.C.D|X:X::X:X) - local-ip (A.B.C.D|X:X::X:X) + remote-ip (A.B.C.D|X:X::X:X) [primary] + local-ip (A.B.C.D|X:X::X:X) [primary] qos-class <0-255> role (sg|asp|ipsp) sctp-role (client|server) @@ -255,6 +255,38 @@ ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role ------------ ------------ ------------- ---- ---- ----------------------- --------- my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201):12345 server +ss7_asp_vty_test(config-cs7-asp)# ! Mark as primary: +ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201 primary +ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101 primary +ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp + Current Primary Link +ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role +------------ ------------ ------------- ---- ---- ----------------------- --------- +my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201*):12345 server +ss7_asp_vty_test(config-cs7-asp)# show running-config +... + local-ip 127.0.0.100 + local-ip 127.0.0.101 primary + remote-ip 127.0.0.200 + remote-ip 127.0.0.201 primary +... +end +ss7_asp_vty_test(config-cs7-asp)# ! Mark as non-primary: +ss7_asp_vty_test(config-cs7-asp)# remote-ip 127.0.0.201 +ss7_asp_vty_test(config-cs7-asp)# local-ip 127.0.0.101 +ss7_asp_vty_test(config-cs7-asp)# do show cs7 instance 0 asp + Current Primary Link +ASP Name AS Name State Type Role Remote IPaddr & Port SCTP Role +------------ ------------ ------------- ---- ---- ----------------------- --------- +my-asp ? uninitialized m3ua sg (127.0.0.200|127.0.0.201):12345 server +ss7_asp_vty_test(config-cs7-asp)# show running-config +... + local-ip 127.0.0.100 + local-ip 127.0.0.101 + remote-ip 127.0.0.200 + remote-ip 127.0.0.201 +... +end ss7_asp_vty_test(config-cs7-asp)# exit ss7_asp_vty_test(config-cs7)# as my-ass m3ua -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/34111 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I4a9fc1a4ad82ed20ece328bc53fca58299d744ca Gerrit-Change-Number: 34111 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • ...
  • 152
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.