summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd/rtadvd.h
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2011-07-14 10:09:58 +0000
committerhrs <hrs@FreeBSD.org>2011-07-14 10:09:58 +0000
commitcdcbea6ad239dd44f37a01b119599e17dac4a5a8 (patch)
treec97e2a5f6ba4790dc756b51374a4d00de9f4ecae /usr.sbin/rtadvd/rtadvd.h
parent90aa2cef03ff2efa8e9af771632eb3d02d0df168 (diff)
downloadFreeBSD-src-cdcbea6ad239dd44f37a01b119599e17dac4a5a8.zip
FreeBSD-src-cdcbea6ad239dd44f37a01b119599e17dac4a5a8.tar.gz
- Refactoring the interface list. It now supports dynamically
added/removed interfaces in a more consistent manner and reloading the configuration file. - Add initial support for control socket. RA information in the daemon can be obtained by rtadvctl(8) instead of SIGUSR1 in a similar manner to ifconfig(8). The information dump has been removed in favor of it. (reload the configuration file) # rtadvctl reload (show RA messages being sent on each interfaces) # rtadvctl show em0: flags=<UP,CONFIGURED,PERSIST> status=<RA_SEND> mtu 1280 DefaultLifetime: 30m MinAdvInterval/MaxAdvInterval: 3m20s/3m20s AdvLinkMTU: <none>, Flags: O, Preference: medium ReachableTime: 0s, RetransTimer: 0s, CurHopLimit: 64 AdvIfPrefixes: yes (show RA messages being sent only on em0) # rtadvctl show em0 (rtadvctl -v show provides additional information) # rtadvctl -v show em0 em0: flags=<UP,CONFIGURED,PERSIST> status=<RA_SEND> mtu 1280 DefaultLifetime: 30m MinAdvInterval/MaxAdvInterval: 3m20s/3m20s AdvLinkMTU: <none>, Flags: O, Preference: medium ReachableTime: 0s, RetransTimer: 0s, CurHopLimit: 64 AdvIfPrefixes: yes Prefixes (1): 2001:db8:1::/64 (CONFIG, vltime=30d, pltime=7d, flags=LA) RDNSS entries: 2001:db8:1::128 (ltime=2m40s) (stop rtadvd) # rtadvctl shutdown A remaining issue when reloading the configuration file is that during that period rtadvd cannot communicate with rtadvctl due to some additional RA sending for graceful shutdown. This will be fixed later.
Diffstat (limited to 'usr.sbin/rtadvd/rtadvd.h')
-rw-r--r--usr.sbin/rtadvd/rtadvd.h60
1 files changed, 48 insertions, 12 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h
index 190bb0d..53bc555 100644
--- a/usr.sbin/rtadvd/rtadvd.h
+++ b/usr.sbin/rtadvd/rtadvd.h
@@ -3,6 +3,7 @@
/*
* Copyright (C) 1998 WIDE Project.
+ * Copyright (C) 2011 Hiroki Sato <hrs@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,6 +31,17 @@
* SUCH DAMAGE.
*/
+#define ELM_MALLOC(p,error_action) \
+ do { \
+ p = malloc(sizeof(*p)); \
+ if (p == NULL) { \
+ syslog(LOG_ERR, "<%s> malloc failed: %s", \
+ __func__, strerror(errno)); \
+ error_action; \
+ } \
+ memset(p, 0, sizeof(*p)); \
+ } while(0)
+
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
@@ -183,12 +195,10 @@ struct rainfo {
int rai_waiting;
/* interface information */
- int rai_ifindex;
+ struct ifinfo *rai_ifinfo;
+
int rai_advlinkopt; /* bool: whether include link-layer addr opt */
int rai_advifprefix; /* bool: gather IF prefixes? */
- struct sockaddr_dl *rai_sdl;
- char rai_ifname[IFNAMSIZ];
- u_int32_t rai_phymtu; /* mtu of the physical interface */
/* Router configuration variables */
u_short rai_lifetime; /* AdvDefaultLifetime */
@@ -218,25 +228,51 @@ struct rainfo {
size_t rai_ra_datalen;
u_char *rai_ra_data;
- /* statistics */
- u_quad_t rai_raoutput; /* # of RAs sent */
- u_quad_t rai_rainput; /* # of RAs received */
- u_quad_t rai_rainconsistent; /* # of RAs inconsistent with ours */
- u_quad_t rai_rsinput; /* # of RSs received */
-
/* info about soliciter */
TAILQ_HEAD(, soliciter) rai_soliciter; /* recent solication source */
};
-/* Interface list including RA information */
+/* RA information list */
extern TAILQ_HEAD(railist_head_t, rainfo) railist;
+#define IFI_STATE_UNCONFIGURED 0
+#define IFI_STATE_CONFIGURED 1
+
+struct ifinfo {
+ TAILQ_ENTRY(ifinfo) ifi_next;
+
+ u_int16_t ifi_state;
+ u_int16_t ifi_persist;
+ u_int16_t ifi_ifindex;
+ char ifi_ifname[IFNAMSIZ];
+ u_int8_t ifi_type;
+ u_int16_t ifi_flags;
+ u_int32_t ifi_nd_flags;
+ u_int32_t ifi_phymtu;
+ struct sockaddr_dl ifi_sdl;
+
+ struct rainfo *ifi_rainfo;
+
+ /* statistics */
+ u_int64_t ifi_raoutput; /* # of RAs sent */
+ u_int64_t ifi_rainput; /* # of RAs received */
+ u_int64_t ifi_rainconsistent; /* # of inconsistent recv'd RAs */
+ u_int64_t ifi_rsinput; /* # of RSs received */
+};
+
+/* Interface list */
+extern TAILQ_HEAD(ifilist_head_t, ifinfo) ifilist;
+
+extern char *mcastif;
+
struct rtadvd_timer *ra_timeout(void *);
void ra_timer_update(void *, struct timeval *);
void ra_output(struct rainfo *);
int prefix_match(struct in6_addr *, int,
struct in6_addr *, int);
-struct rainfo *if_indextorainfo(int);
+struct ifinfo *if_indextoifinfo(int);
struct prefix *find_prefix(struct rainfo *,
struct in6_addr *, int);
+void rtadvd_set_reload(int);
+void rtadvd_set_die(int);
OpenPOWER on IntegriCloud