yaoweibin / nginx_tcp_proxy_module

add the feature of tcp proxy with nginx, with health check and status monitor
http://yaoweibin.github.com/nginx_tcp_proxy_module
1.64k stars 366 forks source link

[nginx_tcp_proxy_module-0.4.5] proplem of port checking in ngx_tcp_core_listen #135

Open lusinking opened 7 years ago

lusinking commented 7 years ago

ngx_tcp_core_module.c文件ngx_tcp_core_listen函数中488行会判断listen端口号是否重复

if (port != u.port)

但是比较符右边的port是由配置端口号字符串强制转换而来,和机器字节序相同,而左边的端口号是从sockaddr_in结构体中读出,是网络字节序,对于机器字节序和网络字节序不同的服务器,会出现判断错误的情况,例如:4660和13345两个端口会被认为重复,就是因为这两个端口的字节序正好相反

看一下是不是有特殊背景还是一个bug?