From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.6906.1646400926550513006 for ; Fri, 04 Mar 2022 05:35:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KB59Zt4m; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: osteffen@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646400925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kxpx2Xjqy6MvSsF7/rWQKX1BifmpCAT/glS13BogP/Y=; b=KB59Zt4mjailItqKjF8/3RYqZqucwP1SOT7lX5dJ13ei5hSMdN0fJ8Z/a425zmsQzcrPpt A8qjgkFQisHf1SLT59b+MS3Mv6Jpj1sYYrDZv1mMwJSQZLdErZiTDRgsNCJ+GtWniGBbXQ IfFs/oG9rUd1K/2NMiJ6e6zJ8/7dtSQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-HP3izbB7OICTgdD_zSiWFQ-1; Fri, 04 Mar 2022 08:35:22 -0500 X-MC-Unique: HP3izbB7OICTgdD_zSiWFQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B55C4653 for ; Fri, 4 Mar 2022 13:35:21 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.39.194.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 106177B5F1; Fri, 4 Mar 2022 13:35:20 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [PATCH 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Date: Fri, 4 Mar 2022 14:34:28 +0100 Message-Id: <20220304133431.53378-2-osteffen@redhat.com> In-Reply-To: <20220304133431.53378-1-osteffen@redhat.com> References: <20220304133431.53378-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=osteffen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before configuring it again. Signed-off-by: Oliver Steffen --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.= c index 9457dd2623..cd54c57404 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle =3D TRUE;=0D Tcp4CfgData->ControlOption =3D Tcp4Option;=0D =20=0D + if ((HttpInstance->State =3D=3D HTTP_STATE_TCP_CONNECTED) ||=0D + (HttpInstance->State =3D=3D HTTP_STATE_TCP_CLOSED))=0D + {=0D + Status =3D HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL);= =0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status));=0D + return Status;=0D + }=0D +=0D + HttpInstance->State =3D HTTP_STATE_TCP_UNCONFIGED;=0D + }=0D +=0D Status =3D HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgDat= a);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status));=0D --=20 2.35.1