Make the skb copy only once we know that it's for a known target.
Implies a rework of some of the early-return gotos.
No functional change.
Change-Id: Ibf5d09c0df2a91cfb50f3181e80114539e4f50a6
Make the skb copy within the worker function instead of its callers.
Combines two identical pieces of code into one.
No functional change.
Change-Id: I9ee97c8a2588ca9f88e79b92a9fa880feaa8e156
Use the existing offsets to network/transport header to determine how
much needs to be pulled back. Then we can combine these code snippets
into one.
No functional change.
Change-Id: I34eeb707da9baad0891d2fbb2d8d9fc95e027204
To not come across the sink's mutation (e.g. `endpoint.address.family`)
just lock way earlier, before to start processing and
translating endpoint to the kernel related structs.
Otherwise the other signaling path may mutate something
which will make the sink unactual and provide
to the `__re_address_translate_ep()` NULLed or garbage structs.
Change-Id: I88d87ae88abe4e37aaa5d3cdda76ed0ca82e4842
16de9688d6 resets the `socket.family` to NULL,
that makes the direct appeal to the corresponding
object unsafe.
E.g. `ps->selected_sfd->socket.family->name` when
filling the streams.
Add a simply guard and log `none` in case
the ip family is NULL.
Change-Id: I7ad7399e32e5d0ffb2fcc919822d05760fdc7421
If the dumper was not opened, then also take care
to clear the recording path, because later
the `response_pcap()` only checks the recording path
itself and not wehther the dumper was actually opened.
Hence NG would report a recording file, which indeed
was never even created.
For consistency reasons add the dumper's guard
in the `response_pcap()`.
Change-Id: Ifc1d5b73785633ffcc6293d64dbfbdea51b54582
The `finish_proc()` misses part of the clean-up
work if the kernel table isn't open.
Only `kernel_del_call()` really depends
on the `kernel.is_open`, local cleanup should still happen.
Change-Id: I8f999dbc48f7dd04b4ca1ba5edbc9218a3c49d29
When setting up streams, we currently check the pointer itself,
whether the kernel table isn't open, an existing stream index
and the `NO_RECORDING` flag.
Check additionally whether the recording call
was actually registered in the kernel.
Otherwise if the `proc_init()` fails to to add call
to the kernel recording interface, `setup_stream_proc()`
still tries to add the stream to the kernel.
Change-Id: Ibaf25d1f91f9818325e3e9f7be3316610f5c63be
Per RFC 4867 section 8.1, absent fmtp parameters imply defaults (bandwidth-efficient mode, no CRC,
no robust-sorting, no interleaving). Previously, codec matching was rejected when either side had no
``a=fmtp`` attribute for the AMR payload type, causing AMR to be dropped as a "stray answer codec".
This patch changes this behavior to instead "parse" fmtp even when absent so that the format struct
is populated with zero-initialized defaults and fmtp_parsed is set.
Closes#2141
Change-Id: I1371cb1fdb9354746a4019477845d777e619a2f6
From the cstdio docs, `snprintf()` - returns the number
of characters that would have been written
if n had been sufficiently large, not counting the terminating null character.
If a formatted unique id gets longer than 128 bytes,
or if the same happens later to the sequence of the formatted paramters,
then the according lenth becomes larger than the `sizeof(...)`,
and then the `append_meta_chunk()` may overflow the given buffer.
Just track the length by the fact after the printing is completed.
Also improve code formatting a little bit.
Change-Id: Ia3082623c4e59bd83c04af4c93851f8778bd73d2
Only do deletion if no other refs are open.
Add new "kill" method to override this.
Handle spurious EBUSY in daemon shutdown.
Change-Id: Ic84a0c3c1e3a007052baf19d22d79cbccf12c414
We use `family == NULL` as test for the socket being open in several
places, and expect it to match the familt of the addresses. Set it to
zero to make it consistent.
Change-Id: Ide2b41e84fc27b5f47f579dcf4ab2ec2f6b0a37e
`vsnprintf()` returns the number of bytes that
would have been written, not the number actually stored in label.
If a formatted label gets longer than 127 bytes,
then the lablen becomes larger than the `sizeof(label)`,
and then `iov[0].iov_len = lablen;` makes the `writev()`
read past the stack buffer.
Similarly for the `infix`, but here the overflow should be less risky.
Also improve logging for the cases of unexpected
written size, or even a failure of the `writev()`.
Change-Id: I1a36ee262bec03c24b582219bc4d5babde685ed8
if rtp parsing failed and didn't set the `ssrc_in`,
then this would potentially be a NULL dereference later,
when handling bundle rtp.
Change-Id: I0e1f1041ffa3df6c44e313d756423fcdea37f579
When raising the log about the invalid port range,
be more concrete about the requirements for the range.
Also log the invalid excluded port.
Additionally: correct the code comment.
Change-Id: I3447003648e28c3ba2d3bfe8f7ed7c1f9425a44b
With big arrays of INTs, even though the variable type
isn't quite heavy, if the pool is for example around
10000...65535 (just because someone needs so many)
this loads the stack quite sensible. Just use heap for
these calculations.
Change-Id: I2ef838a1cb067e6986ba6a6b1c60945d437fabb0
ICE drops packets early in media_demux_protocols() (via
ice_peer_address_known()), which means in media_packet_address_check()
we can immediately set any socket as confirmed that has received
anything.
Take receiving socket into account to determine whether the endpoint is
a match.
Disable endpoint learning with ICE. ICE is in charge of determining
endpoint address and local socket.
`media-handover` and `strict-source` handling remains in place. With
`media-handover` set, we allow changing endpoint and local socket based
on what is actually received, overriding the nomination from ICE.
Change-Id: Ieac2893355df6ee560b497867181e6f47d646f2e
Don't just check for the selected_sfd to be non null, but also for the
socket to actually be open, as this is needed for the translate_ep set
of functions in particular.
Change-Id: I78cb0f7b8c9e4359c9e037485b29f63e0cd9476b