summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcrelay/dhcpd.h
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2017-03-15 14:31:50 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2017-03-15 14:31:50 +0000
commit5f408e08fd8bf86f6e77fa07e833048027c01cf4 (patch)
tree8de83373f5453b2743b1d2313783775663723194 /usr.sbin/dhcrelay/dhcpd.h
parent7a00f75f1939163102bf9679143f8225da5bedb0 (diff)
Improve the interface and addresses discovery code and prepare to
receive IPv6 support. ok reyk@
Diffstat (limited to 'usr.sbin/dhcrelay/dhcpd.h')
-rw-r--r--usr.sbin/dhcrelay/dhcpd.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/dhcrelay/dhcpd.h b/usr.sbin/dhcrelay/dhcpd.h
index 556e81aad71..2e94d39dcb6 100644
--- a/usr.sbin/dhcrelay/dhcpd.h
+++ b/usr.sbin/dhcrelay/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.19 2017/03/14 09:21:26 rzalamena Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.20 2017/03/15 14:31:49 rzalamena Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -39,6 +39,8 @@
* Enterprises, see ``http://www.vix.com''.
*/
+#include <sys/queue.h>
+
#define SERVER_PORT 67
#define CLIENT_PORT 68
@@ -90,7 +92,6 @@ enum dhcp_relay_mode {
};
struct interface_info {
- struct interface_info *next;
struct hardware hw_address;
struct in_addr primary_address;
char name[IFNAMSIZ];
@@ -105,7 +106,14 @@ struct interface_info {
int errors;
int dead;
u_int16_t index;
+
+ int ipv6; /* Has any IPv6 address. */
+ int gipv6; /* Has global IPv6 address. */
+ struct in6_addr linklocal; /* IPv6 link-local address. */
+
+ TAILQ_ENTRY(interface_info) entry;
};
+TAILQ_HEAD(iflist, interface_info);
struct timeout {
struct timeout *next;
@@ -143,7 +151,9 @@ ssize_t receive_packet(struct interface_info *, unsigned char *, size_t,
/* dispatch.c */
extern void (*bootp_packet_handler)(struct interface_info *,
struct dhcp_packet *, int, struct packet_ctx *);
-struct interface_info *get_interface(const char *,
+struct interface_info *iflist_getbyname(const char *);
+void setup_iflist(void);
+struct interface_info *register_interface(const char *,
void (*)(struct protocol *), int isserver);
void dispatch(void);
void got_one(struct protocol *);
@@ -162,6 +172,7 @@ ssize_t decode_udp_ip_header(struct interface_info *, unsigned char *,
/* dhcrelay.c */
extern int server_fd;
+extern struct iflist intflist;
/* crap */
extern time_t cur_time;
@@ -171,3 +182,9 @@ ss2sin(struct sockaddr_storage *ss)
{
return ((struct sockaddr_in *)ss);
}
+
+static inline struct sockaddr_in6 *
+ss2sin6(struct sockaddr_storage *ss)
+{
+ return ((struct sockaddr_in6 *)ss);
+}