On 2016/04/19 21:32, Stuart Henderson wrote:
> Is net.inet.tcp.baddynamic expected to apply to programs using portmap?
Answer: yes.
in_baddynamic() is being called with the port in network-order, so it
doesn't check correctly. I was nearly there, and Todd saved me from
embarassing myself by sending out a diff with ntohs(localport) in ;)
OK?
Index: in_pcb.c
===================================================================
RCS file: /cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.205
diff -u -p -r1.205 in_pcb.c
--- in_pcb.c 13 Apr 2016 06:06:04 -0000 1.205
+++ in_pcb.c 19 Apr 2016 21:34:37 -0000
@@ -473,7 +473,7 @@ in_pcbpickport(u_int16_t *lport, void *l
if (candidate < lower || candidate > higher)
candidate = lower;
localport = htons(candidate);
- } while (in_baddynamic(localport, so->so_proto->pr_protocol) ||
+ } while (in_baddynamic(candidate, so->so_proto->pr_protocol) ||
in_pcblookup_local(table, laddr, localport, wild,
inp->inp_rtableid));
*lport = localport;