From 5f408e08fd8bf86f6e77fa07e833048027c01cf4 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Wed, 15 Mar 2017 14:31:50 +0000 Subject: Improve the interface and addresses discovery code and prepare to receive IPv6 support. ok reyk@ --- usr.sbin/dhcrelay/dhcpd.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'usr.sbin/dhcrelay/dhcpd.h') 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 @@ -39,6 +39,8 @@ * Enterprises, see ``http://www.vix.com''. */ +#include + #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); +} -- cgit v1.2.3