From owner-svn-src-head@freebsd.org Thu Feb 16 20:50:02 2017 Return-Path: Delivered-To: svn-src-head@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 E4526CE2B05; Thu, 16 Feb 2017 20:50:02 +0000 (UTC) (envelope-from vangyzen@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 98ACD1EE7; Thu, 16 Feb 2017 20:50:02 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1GKo1Xn014628; Thu, 16 Feb 2017 20:50:01 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1GKo1DL014626; Thu, 16 Feb 2017 20:50:01 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201702162050.v1GKo1DL014626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Thu, 16 Feb 2017 20:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313822 - in head/sys: libkern netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 20:50:03 -0000 Author: vangyzen Date: Thu Feb 16 20:50:01 2017 New Revision: 313822 URL: https://svnweb.freebsd.org/changeset/base/313822 Log: Remove inet_ntoa() from the kernel inet_ntoa() cannot be used safely in a multithreaded environment because it uses a static local buffer. Remove it from the kernel. Suggested by: glebius, emaste Reviewed by: gnn MFC after: never Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D9625 Modified: head/sys/libkern/inet_ntoa.c head/sys/netinet/in.h Modified: head/sys/libkern/inet_ntoa.c ============================================================================== --- head/sys/libkern/inet_ntoa.c Thu Feb 16 20:47:41 2017 (r313821) +++ head/sys/libkern/inet_ntoa.c Thu Feb 16 20:50:01 2017 (r313822) @@ -36,20 +36,6 @@ __FBSDID("$FreeBSD$"); #include char * -inet_ntoa(struct in_addr ina) -{ - static char buf[4*sizeof "123"]; - unsigned char *ucp = (unsigned char *)&ina; - - sprintf(buf, "%d.%d.%d.%d", - ucp[0] & 0xff, - ucp[1] & 0xff, - ucp[2] & 0xff, - ucp[3] & 0xff); - return buf; -} - -char * inet_ntoa_r(struct in_addr ina, char *buf) { unsigned char *ucp = (unsigned char *)&ina; Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Thu Feb 16 20:47:41 2017 (r313821) +++ head/sys/netinet/in.h Thu Feb 16 20:50:01 2017 (r313822) @@ -646,7 +646,6 @@ int in_localaddr(struct in_addr); int in_localip(struct in_addr); int in_ifhasaddr(struct ifnet *, struct in_addr); int inet_aton(const char *, struct in_addr *); /* in libkern */ -char *inet_ntoa(struct in_addr); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ int inet_pton(int af, const char *, void *); /* in libkern */