From owner-svn-src-all@freebsd.org Sat Oct 28 19:39:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E50ECE4B8F2; Sat, 28 Oct 2017 19:39:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0EDE7E35F; Sat, 28 Oct 2017 19:39:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9SJdMhd026071; Sat, 28 Oct 2017 19:39:22 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SJdMd9026070; Sat, 28 Oct 2017 19:39:22 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201710281939.v9SJdMd9026070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 28 Oct 2017 19:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325064 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 325064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 19:39:24 -0000 Author: oshogbo Date: Sat Oct 28 19:39:22 2017 New Revision: 325064 URL: https://svnweb.freebsd.org/changeset/base/325064 Log: Simplify ping sandbox. We don't need to check if casper is present, this is done in the library itself. Reviewed by: emaste, cem, ed Differential Revision: https://reviews.freebsd.org/D8754 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Sat Oct 28 19:34:08 2017 (r325063) +++ head/sbin/ping/ping.c Sat Oct 28 19:39:22 2017 (r325064) @@ -76,10 +76,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef WITH_CASPER #include #include -#endif #ifdef IPSEC #include @@ -204,15 +202,11 @@ static double tsumsq = 0.0; /* sum of all times square static volatile sig_atomic_t finish_up; static volatile sig_atomic_t siginfo_p; -#ifdef WITH_CASPER static cap_channel_t *capdns; -#endif static void fill(char *, char *); static u_short in_cksum(u_short *, int); -#ifdef WITH_CASPER static cap_channel_t *capdns_setup(void); -#endif static void check_status(void); static void finish(void) __dead2; static void pinger(void); @@ -563,21 +557,17 @@ main(int argc, char *const *argv) if (options & F_PINGFILLED) { fill((char *)datap, payload); } -#ifdef WITH_CASPER capdns = capdns_setup(); -#endif if (source) { bzero((char *)&sock_in, sizeof(sock_in)); sock_in.sin_family = AF_INET; if (inet_aton(source, &sock_in.sin_addr) != 0) { shostname = source; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, source, AF_INET); else -#endif hp = gethostbyname2(source, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -606,11 +596,9 @@ main(int argc, char *const *argv) if (inet_aton(target, &to->sin_addr) != 0) { hostname = target; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, target, AF_INET); else -#endif hp = gethostbyname2(target, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -624,7 +612,6 @@ main(int argc, char *const *argv) hostname = hnamebuf; } -#ifdef WITH_CASPER /* From now on we will use only reverse DNS lookups. */ if (capdns != NULL) { const char *types[1]; @@ -633,7 +620,6 @@ main(int argc, char *const *argv) if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } -#endif if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); @@ -722,10 +708,8 @@ main(int argc, char *const *argv) if (options & F_NUMERIC) cansandbox = true; -#ifdef WITH_CASPER else if (capdns != NULL) cansandbox = true; -#endif else cansandbox = false; @@ -1707,11 +1691,9 @@ pr_addr(struct in_addr ina) if (options & F_NUMERIC) return inet_ntoa(ina); -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET); else -#endif hp = gethostbyaddr((char *)&ina, 4, AF_INET); if (hp == NULL) @@ -1791,7 +1773,6 @@ fill(char *bp, char *patp) } } -#ifdef WITH_CASPER static cap_channel_t * capdns_setup(void) { @@ -1817,7 +1798,6 @@ capdns_setup(void) return (capdnsloc); } -#endif /* WITH_CASPER */ #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) #define SECOPT " [-P policy]"