#include "modules.h"
#include "client.h"
#include "ircd.h"
-#include "ipv4_from_ipv6.h"
static const char extb_desc[] = "Hostmask ($m) extban type";
#ifdef RB_IPV6
/* handle Teredo if necessary */
- if (GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4))
+ if (GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6 && rb_ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4))
{
sprintf(src_ip4host, "%s!%s@", client_p->name, client_p->username);
s4 = src_ip4host + strlen(src_ip4host);
+++ /dev/null
-/*
- * charybdis: An advanced ircd.
- * ipv4_from_ipv6.h: Finds IPv4 addresses behind IPv6 transition technologies
- *
- * Copyright (C) 2012 Jilles Tjoelker
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _IPV4_FROM_IPV6_H_
-#define _IPV4_FROM_IPV6_H_
-
-#ifdef RB_IPV6
-int ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6,
- struct sockaddr_in *restrict ip4);
-#endif
-
-#endif
hash.c \
hook.c \
hostmask.c \
- ipv4_from_ipv6.c \
ircd.c \
ircd_parser.y \
ircd_lexer.l \
#include "s_conf.h" /* ConfigFileEntry, ConfigChannel */
#include "s_newconf.h"
#include "logger.h"
-#include "ipv4_from_ipv6.h"
#include "s_assert.h"
struct config_channel_entry ConfigChannel;
}
#ifdef RB_IPV6
if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 &&
- ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
+ rb_ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
{
sprintf(src_ip4host, "%s!%s@", who->name, who->username);
s4 = src_ip4host + strlen(src_ip4host);
#include "numeric.h"
#include "send.h"
#include "match.h"
-#include "ipv4_from_ipv6.h"
#ifdef RB_IPV6
static unsigned long hash_ipv6(struct sockaddr *, int);
#ifdef RB_IPV6
if(ip != NULL && ip->sa_family == AF_INET6 &&
- ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)ip, &ip4))
+ rb_ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)ip, &ip4))
{
kconf = find_conf_by_address(NULL, NULL, NULL, (struct sockaddr *)&ip4, CONF_KILL, AF_INET, vuser, NULL);
if(kconf)
return aconf;
#ifdef RB_IPV6
if(addr->sa_family == AF_INET6 &&
- ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)addr, &addr2))
+ rb_ipv4_from_ipv6((const struct sockaddr_in6 *)(const void *)addr, &addr2))
{
aconf = find_conf_by_address(NULL, NULL, NULL, (struct sockaddr *)&addr2, CONF_DLINE | 1, AF_INET, NULL, NULL);
if(aconf)
+++ /dev/null
-/*
- * charybdis: A slightly useful ircd.
- * ipv4_from_ipv6.c: Finds IPv4 addresses behind IPv6 transition technologies
- *
- * Copyright (C) 2012 Jilles Tjoelker
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "stdinc.h"
-#include "ipv4_from_ipv6.h"
-
-#ifdef RB_IPV6
-int
-ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6,
- struct sockaddr_in *restrict ip4)
-{
- int i;
-
- if (!memcmp(ip6->sin6_addr.s6_addr, "\x20\x02", 2))
- {
- /* 6to4 and similar */
- memcpy(&ip4->sin_addr, ip6->sin6_addr.s6_addr + 2, 4);
- }
- else if (!memcmp(ip6->sin6_addr.s6_addr, "\x20\x01\x00\x00", 4))
- {
- /* Teredo */
- for (i = 0; i < 4; i++)
- ((uint8_t *)&ip4->sin_addr)[i] = 0xFF ^
- ip6->sin6_addr.s6_addr[12 + i];
- }
- else
- return 0;
- SET_SS_LEN(ip4, sizeof(struct sockaddr_in));
- ip4->sin_family = AF_INET;
- ip4->sin_port = 0;
- return 1;
-}
-#endif /* RB_IPV6 */
unsigned int rb_ssl_handshake_count(rb_fde_t *F);
void rb_ssl_clear_handshake_count(rb_fde_t *F);
-
int rb_pass_fd_to_process(rb_fde_t *, pid_t, rb_fde_t *);
rb_fde_t *rb_recv_fd(rb_fde_t *);
const char *rb_ssl_get_cipher(rb_fde_t *F);
+int rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4);
+
#endif /* INCLUDED_commio_h */
}
-
int
rb_ignore_errno(int error)
{
}
return sendmsg(rb_get_fd(xF), &msg, MSG_NOSIGNAL);
}
-#else
+#else /* defined(HAVE_SENDMSG) && !defined(WIN32) */
#ifndef _WIN32
int
rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds)
errno = ENOSYS;
return -1;
}
-#endif
-#endif
+#endif /* _WIN32 */
+#endif /* defined(HAVE_SENDMSG) && !defined(WIN32) */
+
+#ifdef RB_IPV6
+int
+rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4)
+{
+ int i;
+
+ if (!memcmp(ip6->sin6_addr.s6_addr, "\x20\x02", 2))
+ {
+ /* 6to4 and similar */
+ memcpy(&ip4->sin_addr, ip6->sin6_addr.s6_addr + 2, 4);
+ }
+ else if (!memcmp(ip6->sin6_addr.s6_addr, "\x20\x01\x00\x00", 4))
+ {
+ /* Teredo */
+ for (i = 0; i < 4; i++)
+ ((uint8_t *)&ip4->sin_addr)[i] = 0xFF ^
+ ip6->sin6_addr.s6_addr[12 + i];
+ }
+ else
+ return 0;
+ SET_SS_LEN(ip4, sizeof(struct sockaddr_in));
+ ip4->sin_family = AF_INET;
+ ip4->sin_port = 0;
+ return 1;
+}
+#else
+int
+rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4)
+{
+ return 0;
+}
+#endif /* RB_IPV6 */
rb_init_prng
rb_init_rawbuffers
rb_init_rb_dlink_nodes
+rb_ipv4_from_ipv6
rb_kill
rb_lib_die
rb_lib_init
#include "modules.h"
#include "hook.h"
#include "s_newconf.h"
-#include "ipv4_from_ipv6.h"
#include "ratelimit.h"
#include "s_assert.h"
if (GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6 &&
(show_ip(source_p, target_p) ||
(source_p == target_p && !IsIPSpoof(target_p))) &&
- ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4))
+ rb_ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4))
{
rb_inet_ntop_sock((struct sockaddr *)&ip4,
buf, sizeof buf);