--- dnscache.c 2011-06-03 00:54:35.000000000 +0200 +++ dnscache.c 2011-06-03 00:53:33.000000000 +0200 @@ -445,6 +445,10 @@ if (!ip6_scan(x,myipincoming)) strerr_die3x(111,FATAL,"unable to parse IP address ",x); + unsigned long port = 53; + x = env_get("PORT"); + if (x) scan_ulong(x,&port); + #if 0 /* if if IP is a mapped-IPv4 address, disable IPv6 functionality */ /* this is actually a bad idea */ @@ -455,13 +459,13 @@ udp53 = socket_udp6(); if (udp53 == -1) strerr_die2sys(111,FATAL,"unable to create UDP socket: "); - if (socket_bind6_reuse(udp53,myipincoming,53,interface) == -1) + if (socket_bind6_reuse(udp53,myipincoming,port,interface) == -1) strerr_die2sys(111,FATAL,"unable to bind UDP socket: "); tcp53 = socket_tcp6(); if (tcp53 == -1) strerr_die2sys(111,FATAL,"unable to create TCP socket: "); - if (socket_bind6_reuse(tcp53,myipincoming,53,interface) == -1) + if (socket_bind6_reuse(tcp53,myipincoming,port,interface) == -1) strerr_die2sys(111,FATAL,"unable to bind TCP socket: "); droproot(FATAL);