X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=system.h;h=acfaa373f6650f756fbb3562a63091fd4607749d;hp=05fbcae8c4564df6e4a31cce99075f8480248a7e;hb=7872d4e2889c364ffa8e01ea43e465e21ab32a3c;hpb=87648299f8944a3268210e0315f6b5244d42fa4f diff --git a/system.h b/system.h index 05fbcae..acfaa37 100644 --- a/system.h +++ b/system.h @@ -1,8 +1,22 @@ +/* + * netifd - network interface daemon + * Copyright (C) 2012 Felix Fietkau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ #ifndef __NETIFD_SYSTEM_H #define __NETIFD_SYSTEM_H #include #include +#include #include "device.h" #include "interface-ip.h" @@ -11,6 +25,8 @@ enum tunnel_param { TUNNEL_ATTR_REMOTE, TUNNEL_ATTR_LOCAL, TUNNEL_ATTR_TTL, + TUNNEL_ATTR_6RD_PREFIX, + TUNNEL_ATTR_6RD_RELAY_PREFIX, __TUNNEL_ATTR_MAX }; @@ -34,6 +50,22 @@ struct bridge_config { int max_age; }; +static inline int system_get_addr_family(unsigned int flags) +{ + if ((flags & DEVADDR_FAMILY) == DEVADDR_INET6) + return AF_INET6; + else + return AF_INET; +} + +static inline int system_get_addr_len(unsigned int flags) +{ + if ((flags & DEVADDR_FAMILY) == DEVADDR_INET6) + return sizeof(struct in_addr); + else + return sizeof(struct in6_addr); +} + int system_init(void); int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg); @@ -51,6 +83,9 @@ int system_if_check(struct device *dev); int system_if_dump_info(struct device *dev, struct blob_buf *b); int system_if_dump_stats(struct device *dev, struct blob_buf *b); struct device *system_if_get_parent(struct device *dev); +bool system_if_force_external(const char *ifname); +void system_if_apply_settings(struct device *dev, struct device_settings *s); + int system_add_address(struct device *dev, struct device_addr *addr); int system_del_address(struct device *dev, struct device_addr *addr); @@ -64,4 +99,8 @@ int system_add_ip_tunnel(const char *name, struct blob_attr *attr); time_t system_get_rtime(void); +void system_fd_set_cloexec(int fd); + +int system_update_ipv6_mtu(struct device *device, int mtu); + #endif