From nobody Mon Feb 24 14:54:02 2025 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1kJw6SbTz5pH76 for ; Mon, 24 Feb 2025 14:54:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1kJw3637z3MT8; Mon, 24 Feb 2025 14:54:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-3d1a428471fso35570685ab.2; Mon, 24 Feb 2025 06:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740408847; x=1741013647; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=r7cwyS4oEutoo4HnCaUN2vbFfiszrmjmBIXbtAD3GQQ=; b=KjxXXMx2ZsfHVDHUWwoLvkhuX2gOPx8jdyygY3pmCFpiCZY4+0vtRIQOMnuIjKhd02 ENSe/HPXc/ZcznpKtSTfIw+pQT3q4GIyIbAcHc09dZJrJxWDY6HH1edsaLjghDgwUu89 9oehQ3MlzveaWH592quL0X2FTyKHxRNdhH+SlEfKD0b8ddUTpWoPBeZO6YIIWbvoyCqM DWOCHcFRpuln6iPu/86/qZDJWUH5UTtRYFllgchoRFECEkYeXwa/mXo2g2C3fcF2ws1/ eEuHLhBiOMOyt1go/Fb6pdRcaLU1QtNV3fD+e9gpk914umSfkvY8970TCuPHCOdkPwvn syvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740408847; x=1741013647; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r7cwyS4oEutoo4HnCaUN2vbFfiszrmjmBIXbtAD3GQQ=; b=xJj5Az+tGVOsiMVF1+kofbCZK+/VYoQO9gHaCkbfoeoBQ0wxGgMoyaMbznU9yr5WJb /53fQmCQD7pxQ8GQ9YPHxBnTb1ch/t40da9Wfg33v840wRtseMJXxRmsvXbo6Pub5MTG EWP+OWpZeuMtgbRxDRAUpRmIXuf8m3BRNRXcLq6jtJEbjy1xgzApfcXtmEpg7TQg2Tyn 2YU0fOQUVOwsVFckCi6kYVWW2RCFPxlOntLUOoc6uJcG8amUnizbTgN63WHN7ey+JaBx b9UqoWNFr/VNDrbdDaMeMzr8uc9N4xzsdwsHHwnvBWo2m42s7Xqla0KVT9slfw5cjKxV SvVQ== X-Forwarded-Encrypted: i=1; AJvYcCUDv8m0rbcLD+oj+Qv+JnEDbkId6Bt0qQyRDEaJAJcs09x+OjCfeXHaA0TTi/0vQe4jIP58c41H@freebsd.org, AJvYcCVJmtqtnCoTuvngA28Det3NCk7YO3yLW+WkiZgH4h1vEtlHK3UZ8b/JyIiVf/wgnZ4t44fdFSW1iQ==@freebsd.org X-Gm-Message-State: AOJu0YziWqnTfDgPCZuosGaTZ/+EgX5X+uob7YTroHmpwUTQFQOyL7tB tO4pMxjvyWlB59zOiEWQMJfm4rl9yrAyTWYYjbGOV+i9ng+zJNCw8FTsTA== X-Gm-Gg: ASbGncszJrWvAR8/kuZARKxYICEWtuEDH3g9M32NBHWHVYaAVJRwmxtVTHh/jf3q0qn uzkDLUlZ1RyahwIJqsHE78sVnjn/eqNcl6/JvdVFEx94KkC7FRh4ZBfY0Ye27W2yVR8P8vKXq98 dJYuBMjWKiJHqtNYkDMqNAkp3pRnATpqFQgr1e4mu8jxbJike/B4NyDA+NpUhpkXbnRvt88XmlA zdBEz8bOf9STv5Cg40T4IEUjmQJQR3LZyfspqhQby5O9hU6ALdsdKuC6pC2MxQFRnY5AxXOruNX qWIX+WfNlFj7rqahZIoXT+jflGpv2+ADeupzLo1B X-Google-Smtp-Source: AGHT+IF33XJsYZkOLta/AC6821QqWJf7lDSAHg/owc2QBOA512G9O+pFhcIOE5voOoGEDyYVmQIEdg== X-Received: by 2002:a05:6e02:3f8c:b0:3d0:1fc4:edf0 with SMTP id e9e14a558f8ab-3d2caf18332mr143971435ab.15.1740408846944; Mon, 24 Feb 2025 06:54:06 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d2a82455b8sm31646665ab.57.2025.02.24.06.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 06:54:05 -0800 (PST) Date: Mon, 24 Feb 2025 09:54:02 -0500 From: Mark Johnston To: Zhenlei Huang Cc: Ian FREISLICH , FreeBSD Current , Gleb Smirnoff Subject: Re: buildkernel failure in net/toeplitz.c (commit 3b281d1421a78b588c5fc4182009ce62d8823d95) Message-ID: References: <4858aa49-f102-49fc-90c7-9bd7480306c9@gmail.com> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Z1kJw3637z3MT8 X-Spamd-Bar: ---- On Mon, Feb 24, 2025 at 03:52:14PM +0800, Zhenlei Huang wrote: > > > > On Feb 24, 2025, at 12:42 PM, Ian FREISLICH wrote: > > > > Hi > > > > Building a kernel today failed with: > > > > -Werror /usr/src/sys/net/toeplitz.c > > In file included from /usr/src/sys/net/toeplitz.c:29: > > In file included from /usr/src/sys/net/rss_config.h:33: > > /usr/src/sys/netinet/in.h:692:23: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] > > 692 | return (in.s_addr == htonl(INADDR_BROADCAST) || > > | ^ > > In file included from /usr/src/sys/net/toeplitz.c:32: > > In file included from /usr/src/sys/sys/systm.h:98: > > /usr/src/sys/sys/param.h:343:13: error: conflicting types for 'htonl' > > 343 | __uint32_t htonl(__uint32_t); > > | ^ > > /usr/src/sys/netinet/in.h:692:23: note: previous implicit declaration is here > > 692 | return (in.s_addr == htonl(INADDR_BROADCAST) || > > > > I think this is a result of changes to netinet/in.h (3b281d1421a78) which added a static inline function using ntohl() which is not defined in kernel use. > > > > Ian > > > > > May you please have a try with this patch ? > > ``` > diff --git a/sys/netinet/in.h b/sys/netinet/in.h > index 0925e3aa7669..4dad4e4fed4d 100644 > --- a/sys/netinet/in.h > +++ b/sys/netinet/in.h > @@ -689,8 +689,8 @@ void in_ifdetach(struct ifnet *); > static inline bool > in_broadcast(struct in_addr in) > { > - return (in.s_addr == htonl(INADDR_BROADCAST) || > - in.s_addr == htonl(INADDR_ANY)); > + return (in.s_addr == INADDR_BROADCAST || > + in.s_addr == INADDR_ANY); > } > ``` > > The `htonl` is pointless here, as INADDR_BROADCAST is all 1s, and INADDR_ANY is all 0s. See the review: it's formally unneeded, as you say, but I think the conversions should be there in case this function is ever augmented someday. I think this patch would also work: diff --git a/sys/netinet/in.h b/sys/netinet/in.h index fa710af7cd58..e42422341ada 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -689,8 +689,8 @@ void in_ifdetach(struct ifnet *); static inline bool in_broadcast(struct in_addr in) { - return (in.s_addr == htonl(INADDR_BROADCAST) || - in.s_addr == htonl(INADDR_ANY)); + return (in.s_addr == __htonl(INADDR_BROADCAST) || + in.s_addr == __htonl(INADDR_ANY)); } #define in_hosteq(s, t) ((s).s_addr == (t).s_addr)