Re: dhcpd: remove unused structs

2017-08-03 Thread Rob
Yes, I was going to split it up, but can add that to my diff as well.

Sent from my BlackBerry 10 smartphone on the Rogers network.
  Original Message  
From: Jeremie Courreges-Anglas
Sent: Thursday, August 3, 2017 11:08 AM
To: Rob Pierce
Cc: tech@openbsd.org
Subject: Re: dhcpd: remove unused structs

On Tue, Aug 01 2017, Rob Pierce  wrote:
> I can confirm that the following structs have not been used since at least
> OpenBSD 4.9. From Edgar Pettijohn.
>
> Ok?

ok

Looks like youncould trim this file some more (untested):

@@ -315,20 +290,6 @@ struct protocol {
void (*handler)(struct protocol *);
void *local;
};
-
-/* Bitmask of dhcp option codes. */
-typedef unsigned char option_mask[16];
-
-/* DHCP Option mask manipulation macros... */
-#define OPTION_ZERO(mask)  (memset (mask, 0, 16))
-#define OPTION_SET(mask, bit)  (mask[bit >> 8] |= (1 << (bit & 7)))
-#define OPTION_CLR(mask, bit)  (mask[bit >> 8] &= ~(1 << (bit & 7)))
-#define OPTION_ISSET(mask, bit)(mask[bit >> 8] & (1 << (bit & 7)))
-#define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
-
-/* An option occupies its length plus two header bytes (code and
- length) for every 255 bytes that must be stored. */
-#define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))

#define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases"


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE



Re: dhcpd: remove unused structs

2017-08-03 Thread Jeremie Courreges-Anglas
On Tue, Aug 01 2017, Rob Pierce  wrote:
> I can confirm that the following structs have not been used since at least
> OpenBSD 4.9. From Edgar Pettijohn.
>
> Ok?

ok

Looks like youncould trim this file some more (untested):

@@ -315,20 +290,6 @@ struct protocol {
void (*handler)(struct protocol *);
void *local;
 };
-
-/* Bitmask of dhcp option codes. */
-typedef unsigned char option_mask[16];
-
-/* DHCP Option mask manipulation macros... */
-#define OPTION_ZERO(mask)  (memset (mask, 0, 16))
-#define OPTION_SET(mask, bit)  (mask[bit >> 8] |= (1 << (bit & 7)))
-#define OPTION_CLR(mask, bit)  (mask[bit >> 8] &= ~(1 << (bit & 7)))
-#define OPTION_ISSET(mask, bit)(mask[bit >> 8] & (1 << (bit & 7)))
-#define OPTION_ISCLR(mask, bit)(!OPTION_ISSET (mask, bit))
-
-/* An option occupies its length plus two header bytes (code and
-length) for every 255 bytes that must be stored. */
-#define OPTION_SPACE(x)((x) + 2 * ((x) / 255 + 1))
 
 #define _PATH_DHCPD_CONF   "/etc/dhcpd.conf"
 #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



dhcpd: remove unused structs

2017-08-01 Thread Rob Pierce
I can confirm that the following structs have not been used since at least
OpenBSD 4.9. From Edgar Pettijohn.

Ok?

Index: dhcpd.h
===
RCS file: /cvs/src/usr.sbin/dhcpd/dhcpd.h,v
retrieving revision 1.65
diff -u -p -r1.65 dhcpd.h
--- dhcpd.h 31 Jul 2017 19:00:40 -  1.65
+++ dhcpd.h 1 Aug 2017 22:41:34 -
@@ -73,25 +73,6 @@ struct option_data {
u_int8_t *data;
 };
 
-struct string_list {
-   struct string_list *next;
-   char *string;
-};
-
-/* A name server, from /etc/resolv.conf. */
-struct name_server {
-   struct name_server *next;
-   struct sockaddr_in addr;
-   time_t rcdate;
-};
-
-/* A domain search list element. */
-struct domain_search_list {
-   struct domain_search_list *next;
-   char *domain;
-   time_t rcdate;
-};
-
 /* A dhcp packet and the pointers to its option values. */
 struct packet {
struct dhcp_packet *raw;
@@ -294,12 +275,6 @@ struct interface_info {
int is_udpsock;
ssize_t (*send_packet)(struct interface_info *, struct dhcp_packet *,
size_t, struct in_addr, struct sockaddr_in *, struct hardware *);
-};
-
-struct hardware_link {
-   struct hardware_link *next;
-   char name[IFNAMSIZ];
-   struct hardware address;
 };
 
 struct dhcpd_timeout {