cleanup leftover of IPv6 patch
This commit is contained in:
parent
8f0070db30
commit
273a0d13f3
|
@ -1,22 +0,0 @@
|
|||
IPv6-ready postfix
|
||||
KAME project
|
||||
$KAME: IPv6_README,v 1.2 2001/04/03 01:04:31 itojun Exp $
|
||||
|
||||
|
||||
IPv4 mapped address is not supported.
|
||||
|
||||
TODO:
|
||||
- make it possible to run the following configuration on IPv4-only, and
|
||||
IPv4/v6 dual stack node.
|
||||
inet_interfaces = localhost
|
||||
at this moment, during initialization, localhost will be expanded into
|
||||
INET_ADDR_LIST, then we go through them in socket/bind/listen loop.
|
||||
therefore, if we fail to socket(2) it will be considered a fatal error.
|
||||
instead, we need to manage addresses by string (as is), and then
|
||||
go through it by using getaddrinfo. socket(2) should not be considered
|
||||
a fatal error.
|
||||
|
||||
at this moment, we simply filter out address that is not supported by the
|
||||
kernel. this leads to wrong behavior in some cases.
|
||||
- use sockaddr everywhere, not just 4/16byte address (util/inet_addr_host.c).
|
||||
- update source address selection on virtual host configuration, outbound.
|
|
@ -1,80 +0,0 @@
|
|||
/* System library. */
|
||||
|
||||
#include <sys_defs.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
#ifdef INET6
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
|
||||
#ifdef STRCASECMP_IN_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
/* Utility library. */
|
||||
|
||||
#include <msg.h>
|
||||
#include <mymalloc.h>
|
||||
#include <inet_addr_list.h>
|
||||
#include <inet_addr_local.h>
|
||||
#include <inet_addr_host.h>
|
||||
#include <stringops.h>
|
||||
|
||||
/* Global library. */
|
||||
|
||||
#include <mail_params.h>
|
||||
#include <wildcard_inet_addr.h>
|
||||
|
||||
/* Application-specific. */
|
||||
static INET_ADDR_LIST addr_list;
|
||||
|
||||
/* wildcard_inet_addr_init - initialize my own address list */
|
||||
|
||||
static void wildcard_inet_addr_init(INET_ADDR_LIST *addr_list)
|
||||
{
|
||||
#ifdef INET6
|
||||
struct addrinfo hints, *res, *res0;
|
||||
char hbuf[NI_MAXHOST];
|
||||
int error;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
|
||||
#else
|
||||
const int niflags = NI_NUMERICHOST;
|
||||
#endif
|
||||
|
||||
inet_addr_list_init(addr_list);
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
error = getaddrinfo(NULL, "0", &hints, &res0);
|
||||
if (error)
|
||||
msg_fatal("could not get list of wildcard addresses");
|
||||
for (res = res0; res; res = res->ai_next) {
|
||||
if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
|
||||
NULL, 0, niflags) != 0)
|
||||
continue;
|
||||
if (inet_addr_host(addr_list, hbuf) == 0)
|
||||
msg_fatal("config variable %s: host not found: %s",
|
||||
VAR_INET_INTERFACES, hbuf);
|
||||
}
|
||||
freeaddrinfo(res0);
|
||||
#else
|
||||
if (inet_addr_host(addr_list, "0.0.0.0") == 0)
|
||||
msg_fatal("config variable %s: host not found: %s",
|
||||
VAR_INET_INTERFACES, "0.0.0.0");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* wildcard_inet_addr_list - return list of addresses */
|
||||
|
||||
struct INET_ADDR_LIST *wildcard_inet_addr_list(void)
|
||||
{
|
||||
if (addr_list.used == 0)
|
||||
wildcard_inet_addr_init(&addr_list);
|
||||
|
||||
return (&addr_list);
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef _WILDCARD_INET_ADDR_H_INCLUDED_
|
||||
#define _WILDCARD_INET_ADDR_H_INCLUDED_
|
||||
|
||||
/*++
|
||||
/* NAME
|
||||
/* wildcard_inet_addr_list 3h
|
||||
/* SUMMARY
|
||||
/* grab the list of wildcard IP addresses.
|
||||
/* SYNOPSIS
|
||||
/* #include <own_inet_addr.h>
|
||||
/* DESCRIPTION
|
||||
/* .nf
|
||||
/*--*/
|
||||
|
||||
/*
|
||||
* System library.
|
||||
*/
|
||||
#include <netinet/in.h>
|
||||
#ifdef INET6
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* External interface.
|
||||
*/
|
||||
extern struct INET_ADDR_LIST *wildcard_inet_addr_list(void);
|
||||
|
||||
/* LICENSE
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* foo
|
||||
/* AUTHOR(S)
|
||||
/* Jun-ichiro itojun Hagino
|
||||
/*--*/
|
||||
|
||||
#endif
|
|
@ -1,65 +0,0 @@
|
|||
/*++
|
||||
/* NAME
|
||||
/* get_port 3
|
||||
/* SUMMARY
|
||||
/* trivial host and port extracter
|
||||
/* SYNOPSIS
|
||||
/* #include <get_port.h>
|
||||
/*
|
||||
/* char *get_port(data)
|
||||
/* char *data;
|
||||
/*
|
||||
/* DESCRIPTION
|
||||
/* get_port() extract host name or ip address from
|
||||
/* strings such as [3ffe:902:12::10]:25, [::1]
|
||||
/* or 192.168.0.1:25, and null-terminates the
|
||||
/* \fIdata\fR at the first occurrence of port separator.
|
||||
/* DIAGNOSTICS
|
||||
/* If port not found return null pointer.
|
||||
/* LICENSE
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* BSD Style (or BSD like) license.
|
||||
/* AUTHOR(S)
|
||||
/* Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
|
||||
/* Wroclaw, POLAND
|
||||
/*--*/
|
||||
|
||||
/* System libraries */
|
||||
|
||||
#include <sys_defs.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Utility library. */
|
||||
|
||||
#include "get_port.h"
|
||||
|
||||
/* get_port - extract port number from string */
|
||||
|
||||
char *get_port(char *data)
|
||||
{
|
||||
const char *escl=strchr(data,'[');
|
||||
const char *sepl=strchr(data,':');
|
||||
char *escr=strrchr(data,']');
|
||||
char *sepr=strrchr(data,':');
|
||||
|
||||
/* extract from "[address]:port" or "[address]"*/
|
||||
if (escl && escr)
|
||||
{
|
||||
memmove(data, data + 1, strlen(data) - strlen(escr));
|
||||
data[strlen(data) - strlen(escr) - 1] = 0;
|
||||
*escr++ = 0;
|
||||
if (*escr == ':')
|
||||
escr++;
|
||||
return (*escr ? escr : NULL);
|
||||
}
|
||||
/* extract from "address:port" or "address" */
|
||||
if ((sepl == sepr) && sepr && sepl)
|
||||
{
|
||||
*sepr++ = 0;
|
||||
return sepr;
|
||||
}
|
||||
|
||||
/* return empty string */
|
||||
return NULL;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef _GET_PORT_H_INCLUDED_
|
||||
#define _GET_PORT_H_INCLUDED_
|
||||
|
||||
/*++
|
||||
/* NAME
|
||||
/* get_port 3h
|
||||
/* SUMMARY
|
||||
/* trivial host and port extracter
|
||||
/* SYNOPSIS
|
||||
/* #include <get_port.h>
|
||||
/* DESCRIPTION
|
||||
/* .nf
|
||||
|
||||
/* External interface. */
|
||||
|
||||
extern char *get_port(char *);
|
||||
|
||||
|
||||
/* LICENSE
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* BSD Style (or BSD like) license.
|
||||
/* AUTHOR(S)
|
||||
/* Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
|
||||
/* Wroclaw, POLAND
|
||||
/*--*/
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue