Repository navigation
FreeSBC v0.8.5 stops a DNS-named carrier from pointing the edge at itself, the switch or a private network, makes check --deploy report UDP socket buffer caps that are too small, and documents a safe restart, upgrade and rollback on a single node. Before this release every address in a carrier's DNS answer (except the unspecified one) became an admitted carrier source and the first one the send target, so a split-horizon zone, a wildcard record or a typo could make an internal address a credential-free carrier source. Configuration is compatible: a v0.8.4 file loads as is, with no new, renamed or removed keys and no changed default, but a DNS-named carrier whose answer holds a private or loopback address stops working (see Breaking changes).
curl -fsSL https://github.com/rasonyang/freesbc/releases/latest/download/install.sh | shBreaking changes
None for the configuration file. One behaviour change to check before you upgrade:
- A DNS-named carrier whose answer holds a private, CGNAT, loopback or link-local address now has that address refused (#344, closes #294). The clamp (
carrierAddrPolicy,internal/edge/carrierclamp.go) applies to every A/AAAA and SRV target address of anedge.carriersentry written as a DNS name. A refused address is neither a destination nor an admitted source, wherever it sits in the answer. A carrier written as a literal IP is never clamped.- Always refused: the unspecified address and
0.0.0.0/8, loopback, link-local, multicast, the IPv4 broadcast, FreeSBC's own addresses (public.ip,public.bind,private.ip) and everyedge.switchIP. These stay refused even whenpublic.ipis private. - Refused unless
public.ipis itself private or CGNAT: RFC 1918, IPv6 ULA and CGNAT. This is the condition the public media plane already uses for its destination policy. - Loopback passes only when
public.iporpublic.bindis itself loopback, which is what the edge test harness relies on. - How to check whether it hits you. For each
edge.carriersentry that is a DNS name, resolve it (SRV first, then A/AAAA, as FreeSBC does) from the FreeSBC host and look for a private, CGNAT, loopback or link-local answer. After the upgrade, look in the journal for one WARN per refused address:
carrier DNS answer refused: address not allowed for a DNS-name carrierwithcarrier,host,addrandreason. It is logged once, then at Debug while the address stays in the answer. If nothing is left after the clamp, the lookup counts as failed: the last good set is kept, thecarrier_dns:<name>health item fires, and the error names each refused address and its class. - What to do. Write a carrier on a private network as a literal IP in
edge.carriers. A private TLS carrier then needs an IP SAN in its certificate, optionally withca_file. There is noallow_privatekey. A carrier whose name is public and whose answer is public needs no change.
- Always refused: the unspecified address and
Fixes
- A carrier's DNS answer could make an internal address a carrier source (#344, closes #294).
carrierDirectory.hostAddrsfiltered only the unspecified address. FreeSBC now clamps every address of the answer before the set is used (see Breaking changes for the classes), so a name that resolves to the host itself, to anedge.switchaddress or into the private LAN no longer makes that address a trusted carrier source, a vouched rate-floor socket or a send target. Own and switch addresses are refused too, which covers the single-IP layout, where startup validation cannot check a DNS-named carrier againstedge.switch.- Not covered.
/api/carriersdoes not list the addresses refused from a partly good answer; they appear in the log only. Thecarrier_dnshealth headline still reads "DNS lookup failing" and the detail carries the refusal. Whoever controls the answer can still point the name at their own public address, which is the accepted risk indocs/design.md§14.2.
- Not covered.
Features
-
check --deploynotes a UDP buffer cap below what FreeSBC requests (#349, closes #348). Every UDP SIP socket requests an 8 MiB receive and a 1 MiB send buffer. On a stock Linux hostnet.core.rmem_maxandnet.core.wmem_maxare 212992, so both are capped and the only signal was a start-up WARN. On Linux,check --deploynow reads both values and adds onenoteline for each cap below the request:net.core.rmem_max 212992 < 8388608 requested by every UDP SIP socket: datagrams may drop silently under bursts; add /etc/sysctl.d/90-freesbc.conf (docs/edge.md#udp-socket-buffers) net.core.wmem_max 212992 < 1048576 requested by every UDP SIP socket: sends may stall under bursts; add /etc/sysctl.d/90-freesbc.conf (docs/edge.md#udp-socket-buffers)It is a note, not an error, so the exit code stays 0. An unreadable or unparsable value gives no line, and other operating systems skip the check. The thresholds come from the constants the sockets request (
edge.UDPSIPBuffers()), so the two cannot drift.install.shprints the drop-in. In the systemd next steps (service-configandservice) it prints the/etc/sysctl.d/90-freesbc.confcontents andsysctl -pbeforesystemctl enable --now freesbc, one line per cap that is below the request or unreadable. A larger cap is never lowered, nothing is printed when both are large enough, and the script writes nothing itself.- A running socket keeps its size, so the drop-in takes effect only after a (re)start.
- Not covered. Plain
checkis unchanged.install.shdoes not write the drop-in. The manual check on a stock Ubuntu host (the note disappears aftersysctl -pand the next start logs nobuffer below requestWARN) has not been run. - Docs. UDP socket buffers in
docs/edge.mdand a subsection indocs/install.md.
-
A documented restart, upgrade and rollback on a single node (#345, closes #337).
docs/install.mdhas a new section, Restart and upgrade on one node, anddocs/two-node.mdlinks to it. It states what a single node loses:- Drain refuses new carrier calls (and the related OPTIONS) with 503 until the restart ends, a short outage by design.
active_callsalso counts client calls, which drain does not refuse. - A stop drops calls still up and sends no BYE.
- A restart loses everything held in memory: bindings, carrier registrations (until the switch re-registers, a carrier INVITE with an
fsbc=token falls back to the hash pool), bans, subscriptions and the drain state.
It then gives six steps: keep the old binary; install; run the new binary's
check --deploy --local-addressesas the service user before any outage; run a POSIXshscript that drains, pollsactive_callswith a deadline, restarts and prints the running version and drain state; make a test call; roll back if needed. At the deadline the script does not restart and leaves drain on.- Not covered. The real root systemd path and the install under
FREESBC_VERIFY=requirewith cosign were not run. The script was run in a Linux container with asystemctlshim, and the rollback withinstall.shinto a scratch prefix.
- Drain refuses new carrier calls (and the related OPTIONS) with 503 until the restart ends, a short outage by design.
Internal
- Three more test flakes fixed; no production code changed in any of them.
TestRejectedRegistrationCountsFailureread the metrics beforelogRegistercounted the 403, which runs after the relay. It now waits forRegistrationFailure.TestCaseE_NoLeaksAfterCallsandTestEndReasonDTLSFailurehad the same shape and now wait for both gauges to reach zero and forWebRTCDTLSFailures; those two were found by reading the code and were not reproduced (#343, closes #339).TestLatchRefusalCountedWebRTCPrivateandTestLatchRefusalCountedPlainread the captured log beforelatchReporter.slowhad written the WARN, which comes afterrecordRejected. They now wait witheventually(#347, closes #346).TestALGOutboundCarrierCallandTestALGClientLegResponsesfailed the nightly soak withswitch saw [200], want 180 then 200. The fake switch's own sipgo client dropped a 180 that reached its transaction after the 200 (emiago/sipgo#306), and the edge relayed both.startFakeSwitchnow records every response status per Call-ID in wire order from a transportOnMessagehandler, andcallCodesreads that (#350). Before the changego test -race ./internal/edge -run 'TestALGOutboundCarrierCall|TestALGClientLegResponses' -count=200 -cpu 1,2failed; after it, it passes.
config.PrivateOrCGNAT(internal/config/validate.go) is now exported and shared by the shared-socket validation,publicDestPolicyandcarrierAddrPolicy. No behaviour change.TestUDPBufferNote(internal/app/udpbuffer_test.go) covers the note with an injected reader;TestInstallScriptBufferNumberschecks thatinstall.sh'sRMEM_WANTandWMEM_WANTequaledge.UDPSIPBuffers(). Eight new tests ininternal/edge/carrierclamp_test.gocover each refused class on the A/AAAA and SRV paths, own and switch addresses, a good address behind a private one, keeping the last good set, the privatepublic.iplift, the loopback rule, the WARN, and literal carriers.freesbc.example.yamlnow comments the DNS-name carrier entry with the clamp and the literal-IP advice.
Known limitations and follow-ups
- The soak criterion for #339 is not yet observed. Its second criterion, no failure in the next 7 nightly Soak runs, can only be checked after release. The soak workflow itself has not been run on the #350 change either.
TestALGClientLegResponsesflaked once on the #344 branch (switch saw [200], want 180 then 200) at about the rate it fails on main (1 in 15). That is the flake #350 addresses.- #288 and #298: failed INVITE, MESSAGE and SUBSCRIBE credentials from an admitted source are not counted, and INVITE rejections give no enumeration signal.
- #307: an un-REGISTER (and a wildcard un-REGISTER) still removes a binding on the 2xx alone, without the proof a new binding needs.