Repository navigation
tport_logging: copy IPv6 addresses correctly in HEP capture - #354
Open
KaranGauswami wants to merge 1 commit into
Open
KaranGauswami wants to merge 1 commit into
KaranGauswami wants to merge 1 commit into
Conversation
The IPv6 branches of tport_capt_msg_hepv2() and tport_capt_msg_hepv3() copied the address from su_sin.sin_addr.s_addr. For an IPv6 socket address this reads 4 bytes of sin6_flowinfo, so the HEP source and destination addresses were always "::". Copy su_sin6.sin6_addr with its full size instead. Fixes freeswitch#353
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #353
Problem
For IPv6 transports, the HEP capture sends
::as the source and destination address. The port, IP family, protocol and timestamp fields are correct.Root cause
In
libsofia-sip-ua/tport/tport_logging.c, the IPv6 branches copy the address from the IPv4 member of thesu_sockaddr_tunion (su_sin.sin_addr.s_addr, 4 bytes).For an IPv6 socket address,
su_sin.sin_addris at offset 4. Instruct sockaddr_in6, offset 4 issin6_flowinfo, not the address:The code thus copies 4 bytes of
sin6_flowinfo(usually 0) into a 16-byte field that was set to zero before. The result is always::.The same problem is in:
tport_capt_msg_hepv3(): the source and destination IPv6 chunks (0x0005,0x0006)tport_capt_msg_hepv2():hep_ip6header.hp6_srcandhp6_dstChange
Copy
su_sin6.sin6_addrwith its full size (16 bytes) in the IPv6 branches of HEPv2 and HEPv3. The IPv4 branches do not change.Test
3cc785eeb1with this change and loaded it into FreeSWITCH 1.11.3 (Debian 13, amd64).OPTIONS,REGISTER,INVITE,BYE).Before the change:
After the change (documentation addresses shown):
The replies show the reverse direction correctly. Homer stores the correct
srcIpanddstIp.I did not test the HEPv2 change separately. It is the same correction.