I just did a packet capture from my machine and filtered out all the UDP connections. I saw certain connections using what appears to be a randomly generated UDP Source port, and certain connection using the same Source port as the UDP Destination Port.
I understand that TCP connections will randomize the source port so the response has a "dedicated" port to respond to. But how does it work with UDP?
I'm looking for the authoritative answer. Links to RFC's (or whatnot) would be greatly appreciated.
What determines the UDP Source port?
- Is it randomly generated when a response is expected?
- Does it match the destination port when no response is expected? (instead of using 0 as a source port)?