Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/create_icmp_socket.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/create_icmp_socket.c
r1765 r2725 3 3 * Utility routines. 4 4 * 5 * create raw socket for icmp protocol test permission5 * create raw socket for icmp protocol 6 6 * and drop root privileges if running setuid 7 7 * 8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 9 */ 9 10 10 //#include <sys/types.h>11 //#include <netdb.h>12 //#include <sys/socket.h>13 11 #include "libbb.h" 14 12 15 int create_icmp_socket(void)13 int FAST_FUNC create_icmp_socket(void) 16 14 { 15 int sock; 16 #if 0 17 17 struct protoent *proto; 18 int sock;19 20 18 proto = getprotobyname("icmp"); 21 19 /* if getprotobyname failed, just silently force … … 23 21 sock = socket(AF_INET, SOCK_RAW, 24 22 (proto ? proto->p_proto : 1)); /* 1 == ICMP */ 23 #else 24 sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */ 25 #endif 25 26 if (sock < 0) { 26 27 if (errno == EPERM)
Note:
See TracChangeset
for help on using the changeset viewer.