[PATCH] fold create_icmp6_socket.c into create_icmp_socket.c
Robert P. J. Day
rpjday at mindspring.com
Sun Mar 26 10:07:44 PST 2006
(just in case anyone thought it worth applying this although i'm not
a "diff" expert so i'm not sure what option to use to reflect the fact
that the file create_icmp6_socket.c should be deleted.)
Only in busybox.orig/libbb: create_icmp6_socket.c
diff -pru busybox.orig/libbb/create_icmp_socket.c busybox/libbb/create_icmp_socket.c
--- busybox.orig/libbb/create_icmp_socket.c 2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/create_icmp_socket.c 2006-03-26 13:01:37.000000000 -0500
@@ -35,3 +35,27 @@ int create_icmp_socket(void)
return sock;
}
+
+#ifdef CONFIG_FEATURE_IPV6
+int create_icmp6_socket(void)
+{
+ struct protoent *proto;
+ int sock;
+
+ proto = getprotobyname("ipv6-icmp");
+ /* if getprotobyname failed, just silently force
+ * proto->p_proto to have the correct value for "ipv6-icmp" */
+ if ((sock = socket(AF_INET6, SOCK_RAW,
+ (proto ? proto->p_proto : IPPROTO_ICMPV6))) < 0) {
+ if (errno == EPERM)
+ bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+ else
+ bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
+ }
+
+ /* drop root privs if running setuid */
+ setuid(getuid());
+
+ return sock;
+}
+#endif
diff -pru busybox.orig/libbb/Makefile.in busybox/libbb/Makefile.in
--- busybox.orig/libbb/Makefile.in 2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/Makefile.in 2006-03-26 13:04:30.000000000 -0500
@@ -13,7 +13,7 @@ LIBBB-n:=
LIBBB-y:= \
bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
compare_string_array.c concat_path_file.c copy_file.c copyfd.c \
- create_icmp_socket.c create_icmp6_socket.c \
+ create_icmp_socket.c \
device_open.c dump.c error_msg.c error_msg_and_die.c find_mount_point.c \
find_pid_by_name.c find_root_device.c fgets_str.c full_read.c \
full_write.c get_last_path_component.c get_line_from_file.c \
Signed off by: Robert P. J. Day <rpjday at mindspring.com>
More information about the busybox
mailing list