Fix up some more formatting.

This commit is contained in:
Roy Marples 2009-02-12 10:07:30 +00:00
parent 40dbcc8785
commit 3545609198
6 changed files with 35 additions and 42 deletions

View File

@ -77,8 +77,7 @@ struct if_state {
struct in_addr fail;
};
struct interface
{
struct interface {
char name[IF_NAMESIZE];
struct if_state *state;

View File

@ -49,7 +49,8 @@ struct rt *get_option_routes(const struct dhcp_message *);
ssize_t configure_env(char **, const char *, const struct dhcp_message *,
const struct if_options *);
ssize_t make_message(struct dhcp_message **, const struct interface *, uint8_t);
ssize_t make_message(struct dhcp_message **, const struct interface *,
uint8_t);
int valid_dhcp_packet(unsigned char *);
ssize_t write_lease(const struct interface *, const struct dhcp_message *);

View File

@ -42,14 +42,6 @@
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
# define SIOCGIWNAME 0x8B01
/* FIXME: Some linux kernel verisons DO NOT like this include
* They have the error:
* /usr/include/linux/if.h:92: error: redefinition of `struct ifmap'
* We work around this by defining the above ioctl and using an ifreq
* structure which seems to work fine. */
//# include <linux/wireless.h>
#include <errno.h>
#include <ctype.h>
#include <fnmatch.h>

8
lpf.c
View File

@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
* Copyright 2006-2008 Roy Marples <roy@marples.name>
* Copyright 2006-2009 Roy Marples <roy@marples.name>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -37,7 +37,7 @@
# include <asm/types.h> /* needed for 2.4 kernels for the below header */
# include <linux/filter.h>
# include <netpacket/packet.h>
# define bpf_insn sock_filter
# define bpf_insn sock_filter
# define BPF_SKIPTYPE
# define BPF_ETHCOOK -ETH_HLEN
# define BPF_WHOLEPACKET 0x0fffffff /* work around buggy LPF filters */
@ -60,8 +60,8 @@
/* Broadcast address for IPoIB */
static const uint8_t ipv4_bcast_addr[] = {
0x00, 0xff, 0xff, 0xff,
0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
};
int

47
net.h
View File

@ -66,9 +66,9 @@
* 192.168/16
*/
#ifndef IN_PRIVATE
# define IN_PRIVATE(addr) (((addr & IN_CLASSA_NET) == 0x0a000000) || \
((addr & 0xfff00000) == 0xac100000) || \
((addr & IN_CLASSB_NET) == 0xc0a80000))
# define IN_PRIVATE(addr) (((addr & IN_CLASSA_NET) == 0x0a000000) || \
((addr & 0xfff00000) == 0xac100000) || \
((addr & IN_CLASSB_NET) == 0xc0a80000))
#endif
#define LINKLOCAL_ADDR 0xa9fe0000
@ -103,30 +103,31 @@ int inet_ntocidr(struct in_addr);
int inet_cidrtoaddr(int, struct in_addr *);
int up_interface(const char *);
int do_interface(const char *, void (*)(struct interface **, int, char * const *, struct ifreq *),
struct interface **, int, char * const *,
struct in_addr *, struct in_addr *, int);
int do_interface(const char *,
void (*)(struct interface **, int, char * const *, struct ifreq *),
struct interface **, int, char * const *,
struct in_addr *, struct in_addr *, int);
int if_address(const struct interface *,
const struct in_addr *, const struct in_addr *,
const struct in_addr *, int);
#define add_address(iface, addr, net, brd) \
const struct in_addr *, const struct in_addr *,
const struct in_addr *, int);
#define add_address(iface, addr, net, brd) \
if_address(iface, addr, net, brd, 1)
#define del_address(iface, addr, net) \
#define del_address(iface, addr, net) \
if_address(iface, addr, net, NULL, -1)
#define has_address(iface, addr, net) \
#define has_address(iface, addr, net) \
do_interface(iface, NULL, NULL, 0, NULL, addr, net, 0)
#define get_address(iface, addr, net) \
#define get_address(iface, addr, net) \
do_interface(iface, NULL, NULL, 0, NULL, addr, net, 1)
int if_route(const struct interface *, const struct in_addr *,
const struct in_addr *, const struct in_addr *, int, int);
#define add_route(iface, dest, mask, gate, metric) \
const struct in_addr *, const struct in_addr *, int, int);
#define add_route(iface, dest, mask, gate, metric) \
if_route(iface, dest, mask, gate, metric, 1)
#define change_route(iface, dest, mask, gate, metric) \
#define change_route(iface, dest, mask, gate, metric) \
if_route(iface, dest, mask, gate, metric, 0)
#define del_route(iface, dest, mask, gate, metric) \
#define del_route(iface, dest, mask, gate, metric) \
if_route(iface, dest, mask, gate, metric, -1)
#define del_src_route(iface, dest, mask, gate, metric) \
#define del_src_route(iface, dest, mask, gate, metric) \
if_route(iface, dest, mask, gate, metric, -2)
int arp_flush(void);
void free_routes(struct rt *);
@ -134,22 +135,22 @@ void free_routes(struct rt *);
int open_udp_socket(struct interface *);
const size_t udp_dhcp_len;
ssize_t make_udp_packet(uint8_t **, const uint8_t *, size_t,
struct in_addr, struct in_addr);
struct in_addr, struct in_addr);
ssize_t get_udp_data(const uint8_t **, const uint8_t *);
int valid_udp_packet(const uint8_t *);
int open_socket(struct interface *, int);
ssize_t send_packet(const struct interface *, struct in_addr,
const uint8_t *, ssize_t);
const uint8_t *, ssize_t);
ssize_t send_raw_packet(const struct interface *, int,
const void *, ssize_t);
const void *, ssize_t);
ssize_t get_raw_packet(struct interface *, int, void *, ssize_t);
int init_socket(void);
int open_link_socket(void);
int manage_link(int,
void (*)(const char *),
void (*)(const char *),
void (*)(const char *));
void (*)(const char *),
void (*)(const char *),
void (*)(const char *));
int carrier_status(const char *);
#endif

View File

@ -41,10 +41,10 @@ static int signal_pipe[2];
static const int handle_sigs[] = {
SIGALRM,
SIGHUP,
SIGINT,
SIGPIPE,
SIGTERM
SIGHUP,
SIGINT,
SIGPIPE,
SIGTERM
};
static void