route entry and tcp_usr_connect/tcp_connect
sepherosa at gmail.com
Thu Feb 7 23:15:59 PST 2008
It turns out the previous problem (tcp_timer_2msl) is related to
calling tcp_output() in tcp_usr_connect() and tcp_connect().
For TCP PRU_CONNECT is handled on tcp_thread following two
functions are executed in _that_ thread:
tcp_connect() and tcp_output()
tcp_connect() will call in_pcbladdr() if source address is INADDR_ANY,
then inp's route will be filled. If the target port of this TCP
connection is not tcp_thread's port then we actually use an route
entry on a different CPU and will unref it on different CPU. If we
free the route entry allocated in in_pcbladdr() if target port is not
tcp_thread's port, then tcp_output() in tcp_usr_connect() will
cause problem too, since it is called in tcp_thread, an route entry
in CPU0 will still be installed to inp's route.
So I made following patch:
- If target port is not tcp_thread's port, then we free the route
entry allocated by in_pcbladdr().
- In tcp_usr_connect(), if target port is not tcp_thread's port, we
dispatch tcp_output to the target port to be called.
Please review it:
Live Free or Die
More information about the Submit