From owner-svn-ports-head@freebsd.org Wed Nov 6 17:56:48 2019 Return-Path: Delivered-To: svn-ports-head@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 410651BBCAE; Wed, 6 Nov 2019 17:56:48 +0000 (UTC) (envelope-from lwhsu@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Z3h145Yz4QLJ; Wed, 6 Nov 2019 17:56:48 +0000 (UTC) (envelope-from lwhsu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07F8FC78; Wed, 6 Nov 2019 17:56:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6HulSp084544; Wed, 6 Nov 2019 17:56:47 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Hulf8084543; Wed, 6 Nov 2019 17:56:47 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911061756.xA6Hulf8084543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 6 Nov 2019 17:56:47 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r516910 - in head/net/scapy: . files X-SVN-Group: ports-head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/net/scapy: . files X-SVN-Commit-Revision: 516910 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:56:48 -0000 Author: lwhsu Date: Wed Nov 6 17:56:47 2019 New Revision: 516910 URL: https://svnweb.freebsd.org/changeset/ports/516910 Log: Add a patch which fixes both the alignment on (32bit) platforms where sizeof(long) == 4 and for i386 the offset on the bpf_hdr struct as time_t still is 32bit. PR: 239380 Approved by: bofh (maintainer) Sponsored by: Netflix (bz) Sponsored by: The FreeBSD Foundation (lwhsu) Added: head/net/scapy/files/ head/net/scapy/files/patch-i386 (contents, props changed) Modified: head/net/scapy/Makefile Modified: head/net/scapy/Makefile ============================================================================== --- head/net/scapy/Makefile Wed Nov 6 17:39:03 2019 (r516909) +++ head/net/scapy/Makefile Wed Nov 6 17:56:47 2019 (r516910) @@ -3,7 +3,7 @@ PORTNAME= scapy PORTVERSION= 2.4.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Added: head/net/scapy/files/patch-i386 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/scapy/files/patch-i386 Wed Nov 6 17:56:47 2019 (r516910) @@ -0,0 +1,50 @@ +--- scapy/arch/bpf/supersocket.py.orig 2019-07-29 18:49:37 UTC ++++ scapy/arch/bpf/supersocket.py +@@ -4,9 +4,11 @@ + Scapy *BSD native support - BPF sockets + """ + ++from ctypes import c_long, sizeof + import errno + import fcntl + import os ++import platform + from select import select + import struct + import time +@@ -23,7 +25,10 @@ from scapy.supersocket import SuperSocket + from scapy.compat import raw + + +-if FREEBSD or NETBSD: ++if FREEBSD: ++ # On 32bit architectures long might be 32bit. ++ BPF_ALIGNMENT = sizeof(c_long) ++elif NETBSD: + BPF_ALIGNMENT = 8 # sizeof(long) + else: + BPF_ALIGNMENT = 4 # sizeof(int32_t) +@@ -260,8 +265,21 @@ class L2bpfListenSocket(_L2bpfSocket): + return + + # Extract useful information from the BPF header +- if FREEBSD or NETBSD: +- # struct bpf_xhdr or struct bpf_hdr32 ++ if FREEBSD: ++ # Unless we set BIOCSTSTAMP to something different than BPF_T_MICROTIME ++ # we will get bpf_hdr on FreeBSD, which means that we'll get a ++ # struct timeval, which is time_t, suseconds_t. ++ # On i386 time_t still is 32bit so the bh_tstamp will only be 8 bytes. ++ # We really want to set BIOCSTSTAMP to BPF_T_NANOTIME and be done with this ++ # and it always be 16? ++ if platform.machine() == "i386": ++ # struct bpf_hdr ++ bh_tstamp_offset = 8 ++ else: ++ # struct bpf_hdr (64bit time_t) or struct bpf_xhdr ++ bh_tstamp_offset = 16 ++ elif NETBSD: ++ # struct bpf_hdr or struct bpf_hdr32 + bh_tstamp_offset = 16 + else: + # struct bpf_hdr