diff -C 2 -r usr.sbin/portmap.orig/portmap.8 usr.sbin/portmap/portmap.8 *** usr.sbin/portmap.orig/portmap.8 Thu Apr 4 04:00:38 2002 --- usr.sbin/portmap/portmap.8 Wed Dec 4 18:06:22 2002 *************** *** 49,52 **** --- 49,53 ---- .Op Fl d .Op Fl v + .Op Fl s .Op Fl h Ar bindip .Sh DESCRIPTION *************** *** 107,110 **** --- 108,118 ---- .It Fl v Enable verbose logging of access control checks. + .It Fl s + Bind only to a single address (in addition to 127.0.0.1). The address is + specified with the + .Fl h + option. Useful in a + .Xr jail 8 + centric system. .It Fl h Specify specific IP addresses to bind to for UDP requests. diff -C 2 -r usr.sbin/portmap.orig/portmap.c usr.sbin/portmap/portmap.c *** usr.sbin/portmap.orig/portmap.c Wed Dec 4 10:46:08 2002 --- usr.sbin/portmap/portmap.c Wed Dec 4 18:05:15 2002 *************** *** 120,128 **** char **hosts = NULL; int nhosts = 0; struct sockaddr_in addr; int len = sizeof(struct sockaddr_in); register struct pmaplist *pml; ! while ((c = getopt(argc, argv, "dvh:")) != -1) { switch (c) { --- 120,129 ---- char **hosts = NULL; int nhosts = 0; + int single = 0; struct sockaddr_in addr; int len = sizeof(struct sockaddr_in); register struct pmaplist *pml; ! while ((c = getopt(argc, argv, "dvh:s")) != -1) { switch (c) { *************** *** 141,144 **** --- 142,149 ---- break; + case 's': + single = 1; + break; + default: usage(); *************** *** 146,149 **** --- 151,157 ---- } + if(single == 1 && nhosts != 1) + errx(1, "single address binding requires exactly one host."); + if (!debugging && daemon(0, 0)) err(1, "fork"); *************** *** 204,207 **** --- 212,221 ---- * Add TCP socket */ + + /* + * If single mode then just use the last address above + * otherwise we bind tcp on all addresses. + */ + if(!single) addr.sin_addr.s_addr = 0; if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {