hwaddr.c (13573) | hwaddr.c (13577) |
---|---|
1/* 2 * hwaddr.c - routines that deal with hardware addresses. 3 * (i.e. Ethernet) 4 */ 5 6#include <sys/types.h> 7#include <sys/param.h> 8#include <sys/socket.h> --- 34 unchanged lines hidden (view full) --- 43#define bzero(p,l) memset(p,0,l) 44#define bcmp(a,b,c) memcmp(a,b,c) 45#endif 46 47#ifndef ATF_INUSE /* Not defined on some systems (i.e. Linux) */ 48#define ATF_INUSE 0 49#endif 50 | 1/* 2 * hwaddr.c - routines that deal with hardware addresses. 3 * (i.e. Ethernet) 4 */ 5 6#include <sys/types.h> 7#include <sys/param.h> 8#include <sys/socket.h> --- 34 unchanged lines hidden (view full) --- 43#define bzero(p,l) memset(p,0,l) 44#define bcmp(a,b,c) memcmp(a,b,c) 45#endif 46 47#ifndef ATF_INUSE /* Not defined on some systems (i.e. Linux) */ 48#define ATF_INUSE 0 49#endif 50 |
51/* For BSD 4.4, set arp entry by writing to routing socket */ 52#if defined(BSD) 53#if BSD >= 199306 54extern int bsd_arp_set __P((struct in_addr *, char *, int)); 55#endif 56#endif 57 |
|
51#include "bptypes.h" 52#include "hwaddr.h" 53#include "report.h" 54 55extern int debug; 56 57/* 58 * Hardware address lengths (in bytes) and network name based on hardware --- 111 unchanged lines hidden (view full) --- 170 * to add is already in the cache. (Sigh...) 171 * XXX - Should this error simply be ignored? -gwr 172 */ 173 if (ioctl(s, SIOCSARP, (caddr_t) &arpreq) < 0) { 174 report(LOG_ERR, "ioctl SIOCSARP: %s", get_errmsg()); 175 } 176#endif /* SVR4 */ 177#else /* SIOCSARP */ | 58#include "bptypes.h" 59#include "hwaddr.h" 60#include "report.h" 61 62extern int debug; 63 64/* 65 * Hardware address lengths (in bytes) and network name based on hardware --- 111 unchanged lines hidden (view full) --- 177 * to add is already in the cache. (Sigh...) 178 * XXX - Should this error simply be ignored? -gwr 179 */ 180 if (ioctl(s, SIOCSARP, (caddr_t) &arpreq) < 0) { 181 report(LOG_ERR, "ioctl SIOCSARP: %s", get_errmsg()); 182 } 183#endif /* SVR4 */ 184#else /* SIOCSARP */ |
185#if defined(BSD) && (BSD >= 199306) 186 bsd_arp_set(ia, haddr, halen); 187#else |
|
178 /* 179 * Oh well, SIOCSARP is not defined. Just run arp(8). 180 * Need to delete partial entry first on some systems. 181 * XXX - Gag! 182 */ 183 int status; 184 char buf[256]; 185 char *a; 186 extern char *inet_ntoa(); 187 188 a = inet_ntoa(*ia); 189 sprintf(buf, "arp -d %s; arp -s %s %s temp", 190 a, a, haddrtoa(haddr, halen)); 191 if (debug > 2) 192 report(LOG_INFO, buf); 193 status = system(buf); 194 if (status) 195 report(LOG_ERR, "arp failed, exit code=0x%x", status); 196 return; | 188 /* 189 * Oh well, SIOCSARP is not defined. Just run arp(8). 190 * Need to delete partial entry first on some systems. 191 * XXX - Gag! 192 */ 193 int status; 194 char buf[256]; 195 char *a; 196 extern char *inet_ntoa(); 197 198 a = inet_ntoa(*ia); 199 sprintf(buf, "arp -d %s; arp -s %s %s temp", 200 a, a, haddrtoa(haddr, halen)); 201 if (debug > 2) 202 report(LOG_INFO, buf); 203 status = system(buf); 204 if (status) 205 report(LOG_ERR, "arp failed, exit code=0x%x", status); 206 return; |
207#endif /* ! 4.4 BSD */ |
|
197#endif /* SIOCSARP */ 198} 199 200 201/* 202 * Convert a hardware address to an ASCII string. 203 */ 204char * --- 135 unchanged lines hidden --- | 208#endif /* SIOCSARP */ 209} 210 211 212/* 213 * Convert a hardware address to an ASCII string. 214 */ 215char * --- 135 unchanged lines hidden --- |