2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

1442. [func] New fuctions for manipulating port lists:

dns_portlist_create(), dns_portlist_add(),
                        dns_portlist_remove(), dns_portlist_match(),
                        dns_portlist_attach() and dns_portlist_detach().

1441.   [func]          It is now possible to tell dig to bind to a specific
                        source port.

1440.   [func]          It is now possible to tell named to avoid using
                        certian source ports (avoid-v4-udp-ports,
                        avoid-v6-udp-ports).
developer: marka
reviewer: explorer
This commit is contained in:
Mark Andrews
2003-02-26 05:05:16 +00:00
parent ee84964a7d
commit b312748a11
14 changed files with 600 additions and 20 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.180 2002/08/29 07:45:04 marka Exp $ */
/* $Id: dig.c,v 1.181 2003/02/26 05:05:13 marka Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -996,6 +996,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
char textname[MXNAME];
struct in_addr in4;
struct in6_addr in6;
in_port_t srcport;
char *hash;
cmd = option[0];
if (strlen(option) > 1) {
@@ -1031,12 +1033,24 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
goto invalid_option;
switch (cmd) {
case 'b':
hash = index(value, '#');
if (hash != NULL) {
srcport = (in_port_t) parse_uint(hash + 1,
"port number", MAXPORT);
*hash = '\0';
} else
srcport = 0;
if (have_ipv6 && inet_pton(AF_INET6, value, &in6) == 1)
isc_sockaddr_fromin6(&bind_address, &in6, 0);
isc_sockaddr_fromin6(&bind_address, &in6, srcport);
else if (have_ipv4 && inet_pton(AF_INET, value, &in4) == 1)
isc_sockaddr_fromin(&bind_address, &in4, 0);
else
isc_sockaddr_fromin(&bind_address, &in4, srcport);
else {
if (hash != NULL)
*hash = '#';
fatal("invalid address %s", value);
}
if (hash != NULL)
*hash = '#';
specified_source = ISC_TRUE;
return (value_from_next);
case 'c':