diff options
-rw-r--r-- | Android.mk | 12 | ||||
-rw-r--r-- | CleanSpec.mk | 49 | ||||
-rw-r--r-- | NOTICE | 57 | ||||
-rw-r--r-- | ThirdPartyProject.prop | 9 | ||||
-rw-r--r-- | ping6.c | 50 |
5 files changed, 176 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..fae2721 --- /dev/null +++ b/Android.mk @@ -0,0 +1,12 @@ +ifneq ($(TARGET_SIMULATOR),true) + +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES:= ping6.c +LOCAL_MODULE := ping6 +LOCAL_MODULE_TAGS := eng +LOCAL_STATIC_LIBRARIES := libcutils libc +include $(BUILD_EXECUTABLE) + +endif # TARGET_SIMULATOR != true diff --git a/CleanSpec.mk b/CleanSpec.mk new file mode 100644 index 0000000..b84e1b6 --- /dev/null +++ b/CleanSpec.mk @@ -0,0 +1,49 @@ +# Copyright (C) 2007 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If you don't need to do a full clean build but would like to touch +# a file or delete some intermediate files, add a clean step to the end +# of the list. These steps will only be run once, if they haven't been +# run before. +# +# E.g.: +# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) +# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) +# +# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with +# files that are missing or have been moved. +# +# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. +# Use $(OUT_DIR) to refer to the "out" directory. +# +# If you need to re-do something that's already mentioned, just copy +# the command and add it to the bottom of the list. E.g., if a change +# that you made last week required touching a file and a change you +# made today requires touching the same file, just copy the old +# touch step and add it to the end of the list. +# +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ + +# For example: +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) +#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) + +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ @@ -0,0 +1,57 @@ +Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + +Copyright (c) 1989, 1993 + The Regents of the University of California. All rights reserved. + +This code is derived from software contributed to Berkeley by +Mike Muuss. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/ThirdPartyProject.prop b/ThirdPartyProject.prop new file mode 100644 index 0000000..e7bcccb --- /dev/null +++ b/ThirdPartyProject.prop @@ -0,0 +1,9 @@ +# Copyright 2011 Google Inc. All Rights Reserved. +# Wed, 19 Jan 2011 20:17:59 +0100 +currentVersion=1.73 +version=Unknown +isNative=true +name=ping6 +keywords=ping +onDevice=true +homepage=http\://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ping6/ping6.c @@ -136,7 +136,17 @@ __RCSID("$NetBSD: ping6.c,v 1.73 2010/09/20 11:49:48 ahoka Exp $"); #include <netinet6/ipsec.h> #endif +/* + * We currently don't have the libc support required for these two features in + * Android. Should we get enough support later, feel free to remove the #ifdefs + * altogether. + */ +#undef ANDROID_INCLUDE_MD5_SUPPORT +#undef ANDROID_INCLUDE_RTHDR_SUPPORT + +#ifdef ANDROID_INCLUDE_MD5_SUPPORT #include <md5.h> +#endif struct tv32 { u_int32_t tv32_sec; @@ -197,6 +207,10 @@ u_int options; #define SIN6(s) ((struct sockaddr_in6 *)(s)) +/* Android-specific hacks to get this to compile.*/ +#define INFTIM -1 +#define MAXDNAME 1025 + /* * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum * number of received sequence numbers we can keep track of. Change 128 @@ -269,14 +283,18 @@ char *dnsdecode(const u_char **, const u_char *, const u_char *, char *, size_t); void pr_pack(u_char *, int, struct msghdr *); void pr_exthdrs(struct msghdr *); +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT void pr_ip6opt(void *); void pr_rthdr(void *); +#endif int pr_bitrange(u_int32_t, int, int); void pr_retip(struct ip6_hdr *, u_char *); void summary(void); void tvsub(struct timeval *, struct timeval *); int setpolicy(int, char *); +#ifdef ANDROID_INCLUDE_MD5_SUPPORT char *nigroup(char *); +#endif void usage(void); int @@ -300,7 +318,9 @@ main(int argc, char *argv[]) #endif int usepktinfo = 0; struct in6_pktinfo *pktinfo = NULL; +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT struct ip6_rthdr *rthdr = NULL; +#endif #ifdef IPSEC_POLICY_IPSEC char *policy_in = NULL; char *policy_out = NULL; @@ -326,8 +346,14 @@ main(int argc, char *argv[]) #define ADDOPTS "AE" #endif /*IPSEC_POLICY_IPSEC*/ #endif + +#ifdef ANDROID_INCLUDE_MD5_SUPPORT +#define ANDROID_MD5_OPTS "N" +#else +#define ANDROID_MD5_OPTS "" +#endif while ((ch = getopt(argc, argv, - "a:b:c:dfHg:h:I:i:l:mnNp:qRS:s:tvwW" ADDOPTS)) != -1) { + "a:b:c:dfHg:h:I:i:l:mnp:qRS:s:tvwW" ADDOPTS ANDROID_MD5_OPTS)) != -1) { #undef ADDOPTS switch (ch) { case 'a': @@ -465,9 +491,11 @@ main(int argc, char *argv[]) case 'n': options &= ~F_HOSTNAME; break; +#ifdef ANDROID_INCLUDE_MD5_SUPPORT case 'N': options |= F_NIGROUP; break; +#endif case 'p': /* fill buffer with user pattern */ options |= F_PINGFILLED; fill((char *)datap, optarg); @@ -565,6 +593,7 @@ main(int argc, char *argv[]) } if (argc > 1) { +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT rthlen = CMSG_SPACE(inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1)); if (rthlen == 0) { @@ -572,8 +601,12 @@ main(int argc, char *argv[]) /*NOTREACHED*/ } ip6optlen += rthlen; +#else + errx(1, "compiled without support for routing headers"); +#endif } +#ifdef ANDROID_INCLUDE_MD5_SUPPORT if (options & F_NIGROUP) { target = nigroup(argv[argc - 1]); if (target == NULL) { @@ -581,6 +614,7 @@ main(int argc, char *argv[]) /*NOTREACHED*/ } } else +#endif target = argv[argc - 1]; /* getaddrinfo */ @@ -866,6 +900,7 @@ main(int argc, char *argv[]) #endif if (argc > 1) { /* some intermediate addrs are specified */ +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT int hops, error; int rthdrlen; @@ -896,6 +931,9 @@ main(int argc, char *argv[]) } scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp); +#else + errx(1, "compiled without support for routing headers"); +#endif } if (!(options & F_SRCADDR)) { @@ -929,10 +967,12 @@ main(int argc, char *argv[]) (void *)&hoplimit, sizeof(hoplimit))) err(1, "UDP setsockopt(IPV6_MULTICAST_HOPS)"); +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT if (rthdr && setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR, (void *)rthdr, (rthdr->ip6r_len + 1) << 3)) err(1, "UDP setsockopt(IPV6_RTHDR)"); +#endif if (connect(dummy, (struct sockaddr *)&src, len) < 0) err(1, "UDP connect"); @@ -1677,6 +1717,7 @@ pr_exthdrs(struct msghdr *mhdr) continue; switch (cm->cmsg_type) { +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT case IPV6_HOPOPTS: printf(" HbH Options: "); pr_ip6opt(CMSG_DATA(cm)); @@ -1692,10 +1733,12 @@ pr_exthdrs(struct msghdr *mhdr) printf(" Routing: "); pr_rthdr(CMSG_DATA(cm)); break; +#endif } } } +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT void pr_ip6opt(void *extbuf) { @@ -1747,7 +1790,9 @@ pr_ip6opt(void *extbuf) } return; } +#endif +#ifdef ANDROID_INCLUDE_RTHDR_SUPPORT void pr_rthdr(void *extbuf) { @@ -1780,6 +1825,7 @@ pr_rthdr(void *extbuf) return; } +#endif int pr_bitrange(u_int32_t v, int soff, int ii) @@ -2553,6 +2599,7 @@ setpolicy(int so, char *policy) #endif #endif +#ifdef ANDROID_INCLUDE_MD5_SUPPORT char * nigroup(char *name) { @@ -2596,6 +2643,7 @@ nigroup(char *name) return strdup(hbuf); } +#endif void usage(void) |