Index: rarpd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/rarpd/rarpd.c,v retrieving revision 1.33 diff -u -r1.33 rarpd.c --- rarpd.c 15 Sep 2002 15:37:50 -0000 1.33 +++ rarpd.c 5 Dec 2002 04:04:49 -0000 @@ -115,8 +115,8 @@ struct if_info { struct if_info *ii_next; int ii_fd; /* BPF file descriptor */ - u_long ii_ipaddr; /* IP address of this interface */ - u_long ii_netmask; /* subnet or net mask */ + uint32_t ii_ipaddr; /* IP address of this interface */ + uint32_t ii_netmask; /* subnet or net mask */ u_char ii_eaddr[6]; /* Ethernet address of this interface */ char ii_ifname[sizeof(((struct ifreq *)0)->ifr_name) + 1]; }; @@ -137,22 +137,22 @@ static u_char zero[6]; static int bpf_open(void); -static u_long choose_ipaddr(u_long **, u_long, u_long); +static uint32_t choose_ipaddr(uint32_t **, uint32_t, uint32_t); static char *eatoa(u_char *); static int expand_syslog_m(const char *fmt, char **newfmt); static void init(char *); static void init_one(struct ifreq *, char *); -static char *intoa(u_long); -static u_long ipaddrtonetmask(u_long); +static char *intoa(uint32_t); +static uint32_t ipaddrtonetmask(uint32_t); static void logmsg(int, const char *, ...) __printflike(2, 3); -static int rarp_bootable(u_long); +static int rarp_bootable(uint32_t); static int rarp_check(u_char *, u_int); static void rarp_loop(void); static int rarp_open(char *); static void rarp_process(struct if_info *, u_char *, u_int); static void rarp_reply(struct if_info *, struct ether_header *, - u_long, u_int); -static void update_arptab(u_char *, u_long); + uint32_t, u_int); +static void update_arptab(u_char *, uint32_t); static void usage(void); int @@ -391,9 +391,9 @@ /* Verbose stuff */ if (verbose) for (ii = iflist; ii != NULL; ii = ii->ii_next) - logmsg(LOG_DEBUG, "%s %s 0x%08lx %s", + logmsg(LOG_DEBUG, "%s %s 0x%08x %s", ii->ii_ifname, intoa(ntohl(ii->ii_ipaddr)), - (u_long)ntohl(ii->ii_netmask), eatoa(ii->ii_eaddr)); + (uint32_t)ntohl(ii->ii_netmask), eatoa(ii->ii_eaddr)); } void @@ -498,8 +498,8 @@ struct ether_arp *ap = (struct ether_arp *)(p + sizeof(*ep)); if (len < sizeof(*ep) + sizeof(*ap)) { - logmsg(LOG_ERR, "truncated request, got %u, expected %lu", - len, (u_long)(sizeof(*ep) + sizeof(*ap))); + logmsg(LOG_ERR, "truncated request, got %u, expected %u", + len, (uint32_t)(sizeof(*ep) + sizeof(*ap))); return 0; } /* @@ -626,7 +626,7 @@ * configuration file. */ int -rarp_bootable(u_long addr) +rarp_bootable(uint32_t addr) { #ifdef HAVE_DIRENT_H struct dirent *dent; @@ -637,7 +637,7 @@ char ipname[9]; static DIR *dd = NULL; - (void)sprintf(ipname, "%08lX", (u_long)ntohl(addr)); + (void)sprintf(ipname, "%08X", (uint32_t)ntohl(addr)); /* * If directory is already open, rewind it. Otherwise, open it. @@ -667,8 +667,8 @@ * is on network 'net'; 'netmask' is a mask indicating the network portion * of the address. */ -u_long -choose_ipaddr(u_long **alist, u_long net, u_long netmask) +uint32_t +choose_ipaddr(uint32_t **alist, uint32_t net, uint32_t netmask) { for (; *alist; ++alist) if ((**alist & netmask) == net) @@ -685,7 +685,7 @@ { struct ether_header *ep; struct hostent *hp; - u_long target_ipaddr; + uint32_t target_ipaddr; char ename[256]; ep = (struct ether_header *)pkt; @@ -709,7 +709,7 @@ ename); return; } - target_ipaddr = choose_ipaddr((u_long **)hp->h_addr_list, + target_ipaddr = choose_ipaddr((uint32_t **)hp->h_addr_list, ii->ii_ipaddr & ii->ii_netmask, ii->ii_netmask); if (target_ipaddr == 0) { @@ -749,7 +749,7 @@ } rtmsg; void -update_arptab(u_char *ep, u_long ipaddr) +update_arptab(u_char *ep, uint32_t ipaddr) { int cc; struct sockaddr_inarp *ar, *ar2; @@ -803,7 +803,7 @@ * directly connected network (the family is AF_INET in * this case). */ - logmsg(LOG_ERR, "bogus link family (%d) wrong net for %08lX?\n", + logmsg(LOG_ERR, "bogus link family (%d) wrong net for %08X?\n", ll2->sdl_family, ipaddr); close(r); return; @@ -846,7 +846,7 @@ } #else void -update_arptab(u_char *ep, u_long ipaddr) +update_arptab(u_char *ep, uint32_t ipaddr) { struct arpreq request; struct sockaddr_in *sin; @@ -897,7 +897,7 @@ * ARP request. */ void -rarp_reply(struct if_info *ii, struct ether_header *ep, u_long ipaddr, +rarp_reply(struct if_info *ii, struct ether_header *ep, uint32_t ipaddr, u_int len) { u_int n; @@ -937,8 +937,8 @@ * Get the netmask of an IP address. This routine is used if * SIOCGIFNETMASK doesn't work. */ -u_long -ipaddrtonetmask(u_long addr) +uint32_t +ipaddrtonetmask(uint32_t addr) { addr = ntohl(addr); if (IN_CLASSA(addr)) @@ -947,7 +947,7 @@ return htonl(IN_CLASSB_NET); if (IN_CLASSC(addr)) return htonl(IN_CLASSC_NET); - logmsg(LOG_DEBUG, "unknown IP address class: %08lX", addr); + logmsg(LOG_DEBUG, "unknown IP address class: %08X", addr); return htonl(0xffffffff); } @@ -955,7 +955,7 @@ * A faster replacement for inet_ntoa(). */ char * -intoa(u_long addr) +intoa(uint32_t addr) { char *cp; u_int byte;