From owner-dev-commits-src-main@freebsd.org Sat May 15 07:08:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A471C63C0B7; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhxMV4C3Nz4qwN; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 789372131E; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14F78sIO086292; Sat, 15 May 2021 07:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14F78s3J086291; Sat, 15 May 2021 07:08:54 GMT (envelope-from git) Date: Sat, 15 May 2021 07:08:54 GMT Message-Id: <202105150708.14F78s3J086291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 189f8eea138a - main - libalias: replace placeholder with static constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 189f8eea138a78b09c9f19114b1362b0df1cf87d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 07:08:54 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=189f8eea138a78b09c9f19114b1362b0df1cf87d commit 189f8eea138a78b09c9f19114b1362b0df1cf87d Author: Lutz Donnerhacke AuthorDate: 2021-05-13 21:47:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-15 07:05:30 +0000 libalias: replace placeholder with static constant The field nullAddress in struct libalias is never set and never used. It exists as a placeholder for an unused argument only. Reviewed by: hselasky MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30253 --- sys/netinet/libalias/alias_db.c | 24 ++++++++++++++---------- sys/netinet/libalias/alias_local.h | 2 -- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index cd29c16ac945..518f221c63f9 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -224,6 +224,10 @@ static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); #define NO_DEST_PORT 1 #define NO_SRC_PORT 1 +/* Dummy address used for FindLinkIn/Out() and AddLink(). + The value of this variable is never used. */ +static struct in_addr const NO_ADDR; + /* Data Structures The fundamental data structure used in this program is @@ -1111,12 +1115,12 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0, link_type, 0); if (lnk == NULL) - lnk = _FindLinkOut(la, src_addr, la->nullAddress, src_port, + lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, dst_port, link_type, 0); } if (lnk == NULL && (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { - lnk = _FindLinkOut(la, src_addr, la->nullAddress, src_port, 0, + lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, 0, link_type, 0); } if (lnk != NULL) { @@ -1152,7 +1156,7 @@ FindLinkOut(struct libalias *la, struct in_addr src_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && src_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkOut(la, la->nullAddress, dst_addr, src_port, dst_port, + lnk = _FindLinkOut(la, NO_ADDR, dst_addr, src_port, dst_port, link_type, replace_partial_links); } } @@ -1294,7 +1298,7 @@ FindLinkIn(struct libalias *la, struct in_addr dst_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && alias_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkIn(la, dst_addr, la->nullAddress, dst_port, alias_port, + lnk = _FindLinkIn(la, dst_addr, NO_ADDR, dst_port, alias_port, link_type, replace_partial_links); } } @@ -1376,7 +1380,7 @@ FindFragmentIn1(struct libalias *la, struct in_addr dst_addr, LINK_FRAGMENT_ID, 0); if (lnk == NULL) { - lnk = AddLink(la, la->nullAddress, dst_addr, alias_addr, + lnk = AddLink(la, NO_ADDR, dst_addr, alias_addr, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_ID); } @@ -1399,7 +1403,7 @@ AddFragmentPtrLink(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return AddLink(la, la->nullAddress, dst_addr, la->nullAddress, + return AddLink(la, NO_ADDR, dst_addr, NO_ADDR, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR); } @@ -1409,7 +1413,7 @@ FindFragmentPtr(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return FindLinkIn(la, dst_addr, la->nullAddress, + return FindLinkIn(la, dst_addr, NO_ADDR, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR, 0); } @@ -1669,7 +1673,7 @@ FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkIn(la, la->nullAddress, alias_addr, + lnk = FindLinkIn(la, NO_ADDR, alias_addr, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { la->newDefaultLink = 1; @@ -1701,7 +1705,7 @@ FindAliasAddress(struct libalias *la, struct in_addr original_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkOut(la, original_addr, la->nullAddress, + lnk = FindLinkOut(la, original_addr, NO_ADDR, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { return (la->aliasAddress.s_addr != INADDR_ANY) ? @@ -2317,7 +2321,7 @@ LibAliasRedirectAddr(struct libalias *la, struct in_addr src_addr, struct alias_link *lnk; LIBALIAS_LOCK(la); - lnk = AddLink(la, src_addr, la->nullAddress, alias_addr, + lnk = AddLink(la, src_addr, NO_ADDR, alias_addr, 0, 0, 0, LINK_ADDR); diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index e6374a72ef75..63bfd857f14f 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -89,8 +89,6 @@ struct libalias { /* IP address incoming packets are sent to * if no aliasing link already exists */ struct in_addr targetAddress; - /* Used as a dummy parameter for some function calls */ - struct in_addr nullAddress; /* Lookup table of pointers to chains of link records. * Each link record is doubly indexed into input and * output lookup tables. */