Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created April 26, 2013 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/5466775 to your computer and use it in GitHub Desktop.
Save Habbie/5466775 to your computer and use it in GitHub Desktop.
Add ability to change port nproxy listens on.
diff -ur pdns-3.1.orig/pdns/nproxy.cc pdns-3.1.nproxyport/pdns/nproxy.cc
--- pdns-3.1.orig/pdns/nproxy.cc 2012-05-04 06:13:23.000000000 -0400
+++ pdns-3.1.nproxyport/pdns/nproxy.cc 2012-07-13 10:00:47.394599792 -0400
@@ -198,6 +198,7 @@
("setgid", po::value<int>(), "setgid to this numerical user id")
("origin-address", po::value<string>()->default_value("::"), "Source address for notifications to PowerDNS")
("listen-address", po::value<vector<string> >(), "IP addresses to listen on")
+ ("listen-port", po::value<int>(), "Port to listen on")
("daemon,d", po::value<bool>()->default_value(true), "operate in the background")
("verbose,v", "be verbose");
@@ -224,11 +225,17 @@
else
addresses.push_back("::");
+ int lport;
+ if(g_vm.count("listen-port"))
+ lport=g_vm["listen-port"].as<int>();
+ else
+ lport=53;
+
// create sockets to listen on
syslogFmt(boost::format("Starting up"));
for(vector<string>::const_iterator address = addresses.begin(); address != addresses.end(); ++address) {
- ComboAddress local(*address, 53);
+ ComboAddress local(*address, lport);
int sock = socket(local.sin4.sin_family, SOCK_DGRAM, 0);
if(sock < 0)
throw runtime_error("Creating socket for incoming packets: "+stringerror());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment