summaryrefslogtreecommitdiffstats
path: root/src/peer.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-06 02:22:56 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-06 02:22:56 +0100
commit7adeae186cdf0e986d7b965e5fc000687040ae9f (patch)
tree52925fe14b615c72155009f0f3037bdb26c2f05f /src/peer.h
parentebd9d98fd7a2c08f57b1187a7b9efafbfbb63fe7 (diff)
downloadfastd-7adeae186cdf0e986d7b965e5fc000687040ae9f.tar
fastd-7adeae186cdf0e986d7b965e5fc000687040ae9f.zip
Implement tunneling over IPv6
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/peer.h b/src/peer.h
index cd3d1d9..38f13b2 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -35,13 +35,30 @@ const fastd_eth_addr* fastd_get_source_address(const fastd_context *ctx, fastd_b
const fastd_eth_addr* fastd_get_dest_address(const fastd_context *ctx, fastd_buffer buffer);
fastd_peer* fastd_peer_add(fastd_context *ctx, fastd_peer_config *conf);
-fastd_peer* fastd_peer_add_temp(fastd_context *ctx, in_addr_t address, in_port_t port);
+fastd_peer* fastd_peer_add_temp(fastd_context *ctx, const fastd_peer_address *address);
fastd_peer* fastd_peer_merge(fastd_context *ctx, fastd_peer *perm_peer, fastd_peer *temp_peer);
void fastd_peer_delete(fastd_context *ctx, fastd_peer *peer);
+static inline bool fastd_peer_config_is_floating(const fastd_peer_config *config) {
+ switch (config->address.sa.sa_family) {
+ case AF_UNSPEC:
+ return true;
+
+ case AF_INET:
+ return !config->address.in.sin_addr.s_addr;
+
+ case AF_INET6:
+ return IN6_IS_ADDR_UNSPECIFIED(&config->address.in6.sin6_addr);
+
+ default:
+ /* What is this? I don't even... */
+ return false;
+ }
+}
+
static inline bool fastd_peer_is_floating(fastd_peer *peer) {
- return (peer->config && !peer->config->address);
+ return (peer->config && fastd_peer_config_is_floating(peer->config));
}
static inline bool fastd_peer_is_temporary(fastd_peer *peer) {