/*++ /* NAME /* own_inet_addr 3 /* SUMMARY /* determine if IP address belongs to this mail system instance /* SYNOPSIS /* #include <own_inet_addr.h> /* /* int own_inet_addr(addr) /* struct sockaddr *addr; /* /* INET_ADDR_LIST *own_inet_addr_list() /* /* INET_ADDR_LIST *own_inet_mask_list() /* /* int proxy_inet_addr(addr) /* struct in_addr *addr; /* /* INET_ADDR_LIST *proxy_inet_addr_list() /* DESCRIPTION /* own_inet_addr() determines if the specified IP address belongs /* to this mail system instance, i.e. if this mail system instance /* is supposed to be listening on this specific IP address. /* /* own_inet_addr_list() returns the list of all addresses that /* belong to this mail system instance. /* /* own_inet_mask_list() returns the list of all corresponding /* netmasks. /* /* proxy_inet_addr() determines if the specified IP address is /* listed with the proxy_interfaces configuration parameter. /* /* proxy_inet_addr_list() returns the list of all addresses that /* belong to proxy network interfaces. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA
/*--*/
/* *Avoidrun-timeerrorswhenallnetworkprotocolsaredisabled.We *can'tlookupinterfaceinformation,andwecan'tconvertexplicit *namesoraddresses.
*/ if (inet_proto_info()->ai_family_list[0] == 0) { if (msg_verbose)
msg_info("skipping %s setting - " "all network protocols are disabled",
VAR_INET_INTERFACES); return;
}
/* *Ifwearelisteningonallinterfaces(default),askthesystemwhat *theinterfacesare.
*/ if (strcmp(var_inet_interfaces, INET_INTERFACES_ALL) == 0) { if (inet_addr_local(addr_list, mask_list,
inet_proto_info()->ai_family_list) == 0)
msg_fatal("could not find any active network interfaces");
}
/* *Selectallloopbackinterfacesfromthesystem'savailableinterface *list.
*/ elseif (strcmp(var_inet_interfaces, INET_INTERFACES_LOCAL) == 0) {
inet_addr_list_init(&local_addrs);
inet_addr_list_init(&local_masks); if (inet_addr_local(&local_addrs, &local_masks,
inet_proto_info()->ai_family_list) == 0)
msg_fatal("could not find any active network interfaces"); for (sa = local_addrs.addrs, ma = local_masks.addrs;
sa < local_addrs.addrs + local_addrs.used; sa++, ma++) { if (sock_addr_in_loopback(SOCK_ADDR_PTR(sa))) {
inet_addr_list_append(addr_list, SOCK_ADDR_PTR(sa));
inet_addr_list_append(mask_list, SOCK_ADDR_PTR(ma));
}
}
inet_addr_list_free(&local_addrs);
inet_addr_list_free(&local_masks);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.