1 /* $OpenBSD: dhcpd.h,v 1.55 2016/10/06 16:12:43 krw Exp $ */ 2 3 /* 4 * Copyright (c) 1995, 1996, 1997, 1998, 1999 5 * The Internet Software Consortium. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of The Internet Software Consortium nor the names 17 * of its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND 21 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR 25 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * This software has been written for the Internet Software Consortium 35 * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie 36 * Enterprises. To learn more about the Internet Software Consortium, 37 * see ``http://www.vix.com/isc''. To learn more about Vixie 38 * Enterprises, see ``http://www.vix.com''. 39 */ 40 41 #define ifr_netmask ifr_addr 42 43 #define HAVE_SA_LEN 44 #define HAVE_MKSTEMP 45 46 #define DB_TIMEFMT "%w %Y/%m/%d %T UTC" 47 #define OLD_DB_TIMEFMT "%w %Y/%m/%d %T" 48 49 #define SERVER_PORT 67 50 #define CLIENT_PORT 68 51 52 struct iaddr { 53 int len; 54 unsigned char iabuf[16]; 55 }; 56 57 struct iaddrlist { 58 struct iaddrlist *next; 59 struct iaddr addr; 60 }; 61 62 #define DEFAULT_HASH_SIZE 97 63 64 struct hash_bucket { 65 struct hash_bucket *next; 66 unsigned char *name; 67 int len; 68 unsigned char *value; 69 }; 70 71 struct hash_table { 72 int hash_count; 73 struct hash_bucket *buckets[DEFAULT_HASH_SIZE]; 74 }; 75 76 struct option_data { 77 int len; 78 u_int8_t *data; 79 }; 80 81 struct string_list { 82 struct string_list *next; 83 char *string; 84 }; 85 86 /* A name server, from /etc/resolv.conf. */ 87 struct name_server { 88 struct name_server *next; 89 struct sockaddr_in addr; 90 time_t rcdate; 91 }; 92 93 /* A domain search list element. */ 94 struct domain_search_list { 95 struct domain_search_list *next; 96 char *domain; 97 time_t rcdate; 98 }; 99 100 /* A dhcp packet and the pointers to its option values. */ 101 struct packet { 102 struct dhcp_packet *raw; 103 int packet_length; 104 int packet_type; 105 int options_valid; 106 int client_port; 107 struct iaddr client_addr; 108 struct interface_info *interface; /* Interface on which packet 109 was received. */ 110 struct hardware *haddr; /* Physical link address 111 of local sender (maybe gateway). */ 112 struct shared_network *shared_network; 113 struct option_data options[256]; 114 int got_requested_address; /* True if client sent the 115 dhcp-requested-address option. */ 116 }; 117 118 struct hardware { 119 u_int8_t htype; 120 u_int8_t hlen; 121 u_int8_t haddr[16]; 122 }; 123 124 /* A dhcp lease declaration structure. */ 125 struct lease { 126 struct lease *next; 127 struct lease *prev; 128 struct lease *n_uid, *n_hw; 129 struct lease *waitq_next; 130 131 struct iaddr ip_addr; 132 time_t starts, ends, timestamp; 133 unsigned char *uid; 134 int uid_len; 135 int uid_max; 136 unsigned char uid_buf[32]; 137 char *hostname; 138 char *client_hostname; 139 uint8_t *client_identifier; 140 struct host_decl *host; 141 struct subnet *subnet; 142 struct shared_network *shared_network; 143 struct hardware hardware_addr; 144 145 int client_identifier_len; 146 int flags; 147 #define STATIC_LEASE 1 148 #define BOOTP_LEASE 2 149 #define DYNAMIC_BOOTP_OK 4 150 #define PERSISTENT_FLAGS (DYNAMIC_BOOTP_OK) 151 #define EPHEMERAL_FLAGS (BOOTP_LEASE) 152 #define MS_NULL_TERMINATION 8 153 #define ABANDONED_LEASE 16 154 #define INFORM_NOLEASE 32 155 156 struct lease_state *state; 157 u_int8_t releasing; 158 }; 159 160 struct lease_state { 161 struct lease_state *next; 162 163 struct interface_info *ip; 164 165 time_t offered_expiry; 166 167 struct tree_cache *options[256]; 168 u_int32_t expiry, renewal, rebind; 169 char filename[DHCP_FILE_LEN]; 170 char *server_name; 171 172 struct iaddr from; 173 174 int max_message_size; 175 u_int8_t *prl; 176 int prl_len; 177 int got_requested_address; /* True if client sent the 178 dhcp-requested-address option. */ 179 int got_server_identifier; /* True if client sent the 180 dhcp-server-identifier option. */ 181 struct shared_network *shared_network; /* Shared network of interface 182 on which request arrived. */ 183 184 u_int32_t xid; 185 u_int16_t secs; 186 u_int16_t bootp_flags; 187 struct in_addr ciaddr; 188 struct in_addr giaddr; 189 u_int8_t hops; 190 u_int8_t offer; 191 struct hardware haddr; 192 }; 193 194 #define ROOT_GROUP 0 195 #define HOST_DECL 1 196 #define SHARED_NET_DECL 2 197 #define SUBNET_DECL 3 198 #define CLASS_DECL 4 199 #define GROUP_DECL 5 200 201 /* Group of declarations that share common parameters. */ 202 struct group { 203 struct group *next; 204 205 struct subnet *subnet; 206 struct shared_network *shared_network; 207 208 time_t default_lease_time; 209 time_t max_lease_time; 210 time_t bootp_lease_cutoff; 211 time_t bootp_lease_length; 212 213 char *filename; 214 char *server_name; 215 struct iaddr next_server; 216 217 int boot_unknown_clients; 218 int dynamic_bootp; 219 int allow_bootp; 220 int allow_booting; 221 int get_lease_hostnames; 222 int use_host_decl_names; 223 int use_lease_addr_for_default_route; 224 int authoritative; 225 int always_reply_rfc1048; 226 227 struct tree_cache *options[256]; 228 }; 229 230 /* A dhcp host declaration structure. */ 231 struct host_decl { 232 struct host_decl *n_ipaddr; 233 char *name; 234 struct hardware interface; 235 struct tree_cache *fixed_addr; 236 struct group *group; 237 }; 238 239 struct shared_network { 240 struct shared_network *next; 241 char *name; 242 struct subnet *subnets; 243 struct interface_info *interface; 244 struct lease *leases; 245 struct lease *insertion_point; 246 struct lease *last_lease; 247 248 struct group *group; 249 }; 250 251 struct subnet { 252 struct subnet *next_subnet; 253 struct subnet *next_sibling; 254 struct shared_network *shared_network; 255 struct interface_info *interface; 256 struct iaddr interface_address; 257 struct iaddr net; 258 struct iaddr netmask; 259 260 struct group *group; 261 }; 262 263 struct class { 264 char *name; 265 266 struct group *group; 267 }; 268 269 /* DHCP client lease structure... */ 270 struct client_lease { 271 struct client_lease *next; /* Next lease in list. */ 272 time_t expiry, renewal, rebind; /* Lease timeouts. */ 273 struct iaddr address; /* Address being leased. */ 274 char *server_name; /* Name of boot server. */ 275 char *filename; /* File to boot. */ 276 struct string_list *medium; /* Network medium. */ 277 278 unsigned int is_static : 1; /* If set, lease is from config file. */ 279 unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */ 280 281 struct option_data options[256]; /* Options supplied with lease. */ 282 }; 283 284 /* privsep message. fixed length for easy parsing */ 285 struct pf_cmd { 286 struct in_addr ip; 287 u_int32_t type; 288 }; 289 290 /* Possible states in which the client can be. */ 291 enum dhcp_state { 292 S_REBOOTING, 293 S_INIT, 294 S_SELECTING, 295 S_REQUESTING, 296 S_BOUND, 297 S_RENEWING, 298 S_REBINDING 299 }; 300 301 /* Configuration information from the config file... */ 302 struct client_config { 303 struct option_data defaults[256]; /* Default values for options. */ 304 enum { 305 ACTION_DEFAULT, /* Use server value if present, 306 otherwise default. */ 307 ACTION_SUPERSEDE, /* Always use default. */ 308 ACTION_PREPEND, /* Prepend default to server. */ 309 ACTION_APPEND /* Append default to server. */ 310 } default_actions[256]; 311 312 struct option_data send_options[256]; /* Send these to server. */ 313 u_int8_t required_options[256]; /* Options server must supply. */ 314 u_int8_t requested_options[256]; /* Options to request from server. */ 315 int requested_option_count; /* Number of requested options. */ 316 time_t timeout; /* Start to panic if we don't get a 317 lease in this time period when 318 SELECTING. */ 319 time_t initial_interval; /* All exponential backoff intervals 320 start here. */ 321 time_t retry_interval; /* If the protocol failed to produce 322 an address before the timeout, 323 try the protocol again after this 324 many seconds. */ 325 time_t select_interval; /* Wait this many seconds from the 326 first DHCPDISCOVER before 327 picking an offered lease. */ 328 time_t reboot_timeout; /* When in INIT-REBOOT, wait this 329 long before giving up and going 330 to INIT. */ 331 time_t backoff_cutoff; /* When doing exponential backoff, 332 never back off to an interval 333 longer than this amount. */ 334 struct string_list *media; /* Possible network media values. */ 335 char *script_name; /* Name of config script. */ 336 enum { IGNORE, ACCEPT, PREFER } bootp_policy; 337 /* Ignore, accept or prefer BOOTP 338 responses. */ 339 struct string_list *medium; /* Current network medium. */ 340 341 struct iaddrlist *reject_list; /* Servers to reject. */ 342 }; 343 344 /* Per-interface state used in the dhcp client... */ 345 struct client_state { 346 struct client_lease *active; /* Currently active lease. */ 347 struct client_lease *new; /* New lease. */ 348 struct client_lease *offered_leases; /* Leases offered to us. */ 349 struct client_lease *leases; /* Leases we currently hold. */ 350 struct client_lease *alias; /* Alias lease. */ 351 352 enum dhcp_state state; /* Current state for this interface. */ 353 struct iaddr destination; /* Where to send packet. */ 354 u_int32_t xid; /* Transaction ID. */ 355 u_int16_t secs; /* secs value from DHCPDISCOVER. */ 356 time_t first_sending; /* When was first copy sent? */ 357 time_t interval; /* What's the current resend interval? */ 358 struct string_list *medium; /* Last media type tried. */ 359 360 struct dhcp_packet packet; /* Outgoing DHCP packet. */ 361 int packet_length; /* Actual length of generated packet. */ 362 363 struct iaddr requested_address; /* Address we would like to get. */ 364 365 struct client_config *config; /* Information from config file. */ 366 367 char **scriptEnv; /* Client script env */ 368 int scriptEnvsize; /* size of the env table */ 369 370 struct string_list *env; /* Client script environment. */ 371 int envc; /* Number of entries in environment. */ 372 }; 373 374 /* Information about each network interface. */ 375 376 struct interface_info { 377 struct interface_info *next; /* Next interface in list... */ 378 struct shared_network *shared_network; 379 /* Networks connected to this interface. */ 380 struct hardware hw_address; /* Its physical address. */ 381 struct in_addr primary_address; /* Primary interface address. */ 382 char name[IFNAMSIZ]; /* Its name... */ 383 int rfdesc; /* Its read file descriptor. */ 384 int wfdesc; /* Its write file descriptor, if 385 different. */ 386 unsigned char *rbuf; /* Read buffer, if required. */ 387 size_t rbuf_max; /* Size of read buffer. */ 388 size_t rbuf_offset; /* Current offset into buffer. */ 389 size_t rbuf_len; /* Length of data in buffer. */ 390 391 struct ifreq *ifp; /* Pointer to ifreq struct. */ 392 393 /* Only used by DHCP client code. */ 394 struct client_state *client; 395 int noifmedia; 396 int errors; 397 int dead; 398 u_int16_t index; 399 int is_udpsock; 400 ssize_t (*send_packet)(struct interface_info *, struct dhcp_packet *, 401 size_t, struct in_addr, struct sockaddr_in *, struct hardware *); 402 }; 403 404 struct hardware_link { 405 struct hardware_link *next; 406 char name[IFNAMSIZ]; 407 struct hardware address; 408 }; 409 410 struct dhcpd_timeout { 411 struct dhcpd_timeout *next; 412 time_t when; 413 void (*func)(void *); 414 void *what; 415 }; 416 417 struct protocol { 418 struct protocol *next; 419 int fd; 420 void (*handler)(struct protocol *); 421 void *local; 422 }; 423 424 /* Bitmask of dhcp option codes. */ 425 typedef unsigned char option_mask[16]; 426 427 /* DHCP Option mask manipulation macros... */ 428 #define OPTION_ZERO(mask) (memset (mask, 0, 16)) 429 #define OPTION_SET(mask, bit) (mask[bit >> 8] |= (1 << (bit & 7))) 430 #define OPTION_CLR(mask, bit) (mask[bit >> 8] &= ~(1 << (bit & 7))) 431 #define OPTION_ISSET(mask, bit) (mask[bit >> 8] & (1 << (bit & 7))) 432 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit)) 433 434 /* An option occupies its length plus two header bytes (code and 435 length) for every 255 bytes that must be stored. */ 436 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1)) 437 438 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" 439 #define _PATH_DHCPD_DB "/var/db/dhcpd.leases" 440 #define _PATH_DEV_PF "/dev/pf" 441 #define DHCPD_LOG_FACILITY LOG_DAEMON 442 443 #define MAX_TIME 0x7fffffff 444 #define MIN_TIME 0 445 446 /* External definitions... */ 447 448 /* options.c */ 449 void parse_options(struct packet *); 450 void parse_option_buffer(struct packet *, unsigned char *, int); 451 int cons_options(struct packet *, struct dhcp_packet *, int, 452 struct tree_cache **, int, int, int, u_int8_t *, int); 453 char *pretty_print_option(unsigned int, unsigned char *, int, int, int); 454 void do_packet(struct interface_info *, struct dhcp_packet *, int, 455 unsigned int, struct iaddr, struct hardware *); 456 457 /* errwarn.c */ 458 extern int warnings_occurred; 459 void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 460 int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 461 int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 462 int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 463 int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); 464 465 /* dhcpd.c */ 466 extern time_t cur_time; 467 extern struct group root_group; 468 469 extern u_int16_t server_port; 470 extern u_int16_t client_port; 471 extern int log_priority; 472 extern int log_perror; 473 474 extern char *path_dhcpd_conf; 475 extern char *path_dhcpd_db; 476 477 int main(int, char *[]); 478 void cleanup(void); 479 void lease_pinged(struct iaddr, u_int8_t *, int); 480 void lease_ping_timeout(void *); 481 void periodic_scan(void *); 482 483 /* conflex.c */ 484 extern int lexline, lexchar; 485 extern char *token_line, *tlname; 486 extern char comments[4096]; 487 extern int comment_index; 488 extern int eol_token; 489 490 void new_parse(char *); 491 int next_token(char **, FILE *); 492 int peek_token(char **, FILE *); 493 494 /* confpars.c */ 495 int readconf(void); 496 void read_leases(void); 497 int parse_statement(FILE *, struct group *, int, struct host_decl *, int); 498 void parse_allow_deny(FILE *, struct group *, int); 499 void skip_to_semi(FILE *); 500 int parse_boolean(FILE *); 501 int parse_semi(FILE *); 502 int parse_lbrace(FILE *); 503 void parse_host_declaration(FILE *, struct group *); 504 char *parse_host_name(FILE *); 505 void parse_class_declaration(FILE *, struct group *, int); 506 void parse_lease_time(FILE *, time_t *); 507 void parse_shared_net_declaration(FILE *, struct group *); 508 void parse_subnet_declaration(FILE *, struct shared_network *); 509 void parse_group_declaration(FILE *, struct group *); 510 void parse_hardware_param(FILE *, struct hardware *); 511 char *parse_string(FILE *); 512 513 struct tree *parse_ip_addr_or_hostname(FILE *, int); 514 struct tree_cache *parse_fixed_addr_param(FILE *); 515 void parse_option_param(FILE *, struct group *); 516 time_t parse_timestamp(FILE *); 517 struct lease *parse_lease_declaration(FILE *); 518 void parse_address_range(FILE *, struct subnet *); 519 time_t parse_date(FILE *); 520 unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *, 521 int, int, int); 522 void convert_num(unsigned char *, char *, int, int); 523 524 /* tree.c */ 525 pair cons(caddr_t, pair); 526 struct tree_cache *tree_cache(struct tree *); 527 struct tree *tree_host_lookup(char *); 528 struct dns_host_entry *enter_dns_host(char *); 529 struct tree *tree_const(unsigned char *, int); 530 struct tree *tree_concat(struct tree *, struct tree *); 531 struct tree *tree_limit(struct tree *, int); 532 int tree_evaluate(struct tree_cache *); 533 534 /* dhcp.c */ 535 extern int outstanding_pings; 536 537 void dhcp(struct packet *, int); 538 void dhcpdiscover(struct packet *); 539 void dhcprequest(struct packet *); 540 void dhcprelease(struct packet *); 541 void dhcpdecline(struct packet *); 542 void dhcpinform(struct packet *); 543 void nak_lease(struct packet *, struct iaddr *cip); 544 void ack_lease(struct packet *, struct lease *, unsigned int, time_t); 545 void dhcp_reply(struct lease *); 546 struct lease *find_lease(struct packet *, struct shared_network *, int *); 547 struct lease *mockup_lease(struct packet *, struct shared_network *, 548 struct host_decl *); 549 550 /* bootp.c */ 551 void bootp(struct packet *); 552 553 /* memory.c */ 554 void enter_host(struct host_decl *); 555 struct host_decl *find_hosts_by_haddr(int, unsigned char *, int); 556 struct host_decl *find_hosts_by_uid(unsigned char *, int); 557 struct subnet *find_host_for_network(struct host_decl **, struct iaddr *, 558 struct shared_network *); 559 void new_address_range(struct iaddr, struct iaddr, struct subnet *, int); 560 extern struct subnet *find_grouped_subnet(struct shared_network *, 561 struct iaddr); 562 extern struct subnet *find_subnet(struct iaddr); 563 void enter_shared_network(struct shared_network *); 564 int subnet_inner_than(struct subnet *, struct subnet *, int); 565 void enter_subnet(struct subnet *); 566 void enter_lease(struct lease *); 567 int supersede_lease(struct lease *, struct lease *, int); 568 void release_lease(struct lease *); 569 void abandon_lease(struct lease *, char *); 570 struct lease *find_lease_by_uid(unsigned char *, int); 571 struct lease *find_lease_by_hw_addr(unsigned char *, int); 572 struct lease *find_lease_by_ip_addr(struct iaddr); 573 void uid_hash_add(struct lease *); 574 void uid_hash_delete(struct lease *); 575 void hw_hash_add(struct lease *); 576 void hw_hash_delete(struct lease *); 577 struct class *add_class(int, char *); 578 struct class *find_class(int, unsigned char *, int); 579 struct group *clone_group(struct group *, char *); 580 void write_leases(void); 581 582 /* alloc.c */ 583 struct tree_cache *new_tree_cache(char *); 584 struct lease_state *new_lease_state(char *); 585 void free_lease_state(struct lease_state *, char *); 586 void free_tree_cache(struct tree_cache *); 587 588 /* print.c */ 589 char *print_hw_addr(int, int, unsigned char *); 590 591 /* bpf.c */ 592 int if_register_bpf(struct interface_info *); 593 void if_register_send(struct interface_info *); 594 void if_register_receive(struct interface_info *); 595 ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, 596 struct sockaddr_in *, struct hardware *); 597 598 /* dispatch.c */ 599 extern struct interface_info *interfaces; 600 extern struct protocol *protocols; 601 extern struct dhcpd_timeout *timeouts; 602 void discover_interfaces(int *); 603 void dispatch(void); 604 int locate_network(struct packet *); 605 void got_one(struct protocol *); 606 void add_timeout(time_t, void (*)(void *), void *); 607 void cancel_timeout(void (*)(void *), void *); 608 void add_protocol (char *, int, void (*)(struct protocol *), void *); 609 void remove_protocol(struct protocol *); 610 611 /* hash.c */ 612 struct hash_table *new_hash(void); 613 void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); 614 void delete_hash_entry(struct hash_table *, unsigned char *, int); 615 unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); 616 617 /* tables.c */ 618 extern struct option dhcp_options[256]; 619 extern unsigned char dhcp_option_default_priority_list[256]; 620 extern char *hardware_types[256]; 621 extern struct hash_table universe_hash; 622 extern struct universe dhcp_universe; 623 void initialize_universes(void); 624 625 /* convert.c */ 626 u_int32_t getULong(unsigned char *); 627 int32_t getLong(unsigned char *); 628 u_int16_t getUShort(unsigned char *); 629 int16_t getShort(unsigned char *); 630 void putULong(unsigned char *, u_int32_t); 631 void putLong(unsigned char *, int32_t); 632 void putUShort(unsigned char *, unsigned int); 633 void putShort(unsigned char *, int); 634 635 /* inet.c */ 636 struct iaddr subnet_number(struct iaddr, struct iaddr); 637 struct iaddr ip_addr(struct iaddr, struct iaddr, u_int32_t); 638 u_int32_t host_addr(struct iaddr, struct iaddr); 639 int addr_eq(struct iaddr, struct iaddr); 640 char *piaddr(struct iaddr); 641 642 /* db.c */ 643 int write_lease(struct lease *); 644 int commit_leases(void); 645 void db_startup(void); 646 void new_lease_file(void); 647 648 /* packet.c */ 649 void assemble_hw_header(struct interface_info *, unsigned char *, 650 int *, struct hardware *); 651 void assemble_udp_ip_header(struct interface_info *, unsigned char *, 652 int *, u_int32_t, u_int32_t, unsigned int, unsigned char *, int); 653 ssize_t decode_hw_header(struct interface_info *, unsigned char *, 654 int, struct hardware *); 655 ssize_t decode_udp_ip_header(struct interface_info *, unsigned char *, 656 int, struct sockaddr_in *, int); 657 u_int32_t checksum(unsigned char *, unsigned, u_int32_t); 658 u_int32_t wrapsum(u_int32_t); 659 660 /* icmp.c */ 661 void icmp_startup(int, void (*)(struct iaddr, u_int8_t *, int)); 662 int icmp_echorequest(struct iaddr *); 663 void icmp_echoreply(struct protocol *); 664 665 /* pfutils.c */ 666 __dead void pftable_handler(void); 667 void pf_change_table(int, int, struct in_addr, char *); 668 void pf_kill_state(int, struct in_addr); 669 size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); 670 #define vwrite (ssize_t (*)(int, void *, size_t))write 671 void pfmsg(char, struct lease *); 672 extern struct syslog_data sdata; 673 674 /* udpsock.c */ 675 void udpsock_startup(struct in_addr); 676