反向代理连接服务端时获取的端口限制在10000到65535之间问题
Closed this issue · 1 comments
Arnoldream commented
- [https://github.com/F-Stack/f-stack/blob/dev/freebsd/netinet/in_pcb.c
-我测试反向代理时发现连接服务端时获取的端口没有限制在10000到65535之间,通过查看代码发现in_pcb_lport_dest函数中lastport给lport赋值时执行了htons,不是很理解,希望能解惑。
++*lastport;
if (*lastport < first || *lastport > last)
*lastport = first;
lport = htons(*lastport);
Arnoldream commented
是转换字节序后进行检查,理解错误