DragonFly commits List (threaded) for 2011-08
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
git: inpcb: Don't choose lport which could render same addr/port pair
commit e0808efe65f7e3a18feaf7a71cca261f4100538a
Author: Sepherosa Ziehau <sephe@dragonflybsd.org>
Date: Fri Aug 19 10:05:47 2011 +0800
inpcb: Don't choose lport which could render same addr/port pair
A TCP connect to 127.0.0.1:PORT_A could be successful even if there is
no process listening on PORT_A:
127.0.0.1:PORT_A <---> 127.0.0.1:PORT_A
The problem here is that PORT_A is chosen as the lport for the socket
to be connected to PORT_A, and this actually creates simultaneous connect
on 127.0.0.1 but with only one inpcb. Socket connected in this way is
useless and could break connect retry for the service listens on the
loopback interface. Therefore, we skip the lport if the result will be:
(lport == fport && laddr == faddr)
NOTE: This still does not guard against explicit local port and address
chosen using bind(2) and then calling connect(2)
Summary of changes:
sys/netinet/in_pcb.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e0808efe65f7e3a18feaf7a71cca261f4100538a
--
DragonFly BSD source repository
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]