Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Apr 2021 14:49:47 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5f5bf88949df - main - pfsync: Expose PFSYNCF_OK flag to userspace
Message-ID:  <202104261449.13QEnlSJ032407@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f5bf88949df421ec3ccd7e14a999e8d8b9251bf

commit 5f5bf88949df421ec3ccd7e14a999e8d8b9251bf
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-04-23 12:24:59 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-04-26 12:31:17 +0000

    pfsync: Expose PFSYNCF_OK flag to userspace
    
    Add 'syncok' field to ifconfig's pfsync interface output. This allows
    userspace to figure out when pfsync has completed the initial bulk
    import.
    
    Reviewed by:    donner
    MFC after:      2 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D29948
---
 sbin/ifconfig/ifpfsync.c   | 5 ++++-
 sys/net/if_pfsync.h        | 2 ++
 sys/netpfil/pf/if_pfsync.c | 5 +----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sbin/ifconfig/ifpfsync.c b/sbin/ifconfig/ifpfsync.c
index 6df38c1ac997..60e3d4360aa3 100644
--- a/sbin/ifconfig/ifpfsync.c
+++ b/sbin/ifconfig/ifpfsync.c
@@ -206,7 +206,10 @@ pfsync_status(int s)
 	if (preq.pfsyncr_syncdev[0] != '\0' ||
 	    preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP)) {
 		printf("maxupd: %d ", preq.pfsyncr_maxupdates);
-		printf("defer: %s\n", preq.pfsyncr_defer ? "on" : "off");
+		printf("defer: %s\n",
+		    (preq.pfsyncr_defer & PFSYNCF_DEFER) ? "on" : "off");
+		printf("\tsyncok: %d\n",
+		    (preq.pfsyncr_defer & PFSYNCF_OK) ? 1 : 0);
 	}
 }
 
diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h
index ccd26c9ac0de..1bf9934d3422 100644
--- a/sys/net/if_pfsync.h
+++ b/sys/net/if_pfsync.h
@@ -236,6 +236,8 @@ struct pfsyncreq {
 	char		 pfsyncr_syncdev[IFNAMSIZ];
 	struct in_addr	 pfsyncr_syncpeer;
 	int		 pfsyncr_maxupdates;
+#define	PFSYNCF_OK		0x00000001
+#define	PFSYNCF_DEFER		0x00000002
 	int		 pfsyncr_defer;
 };
 
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index 06bad556e885..96813fd11dc3 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -215,8 +215,6 @@ struct pfsync_softc {
 	struct ip_moptions	sc_imo;
 	struct in_addr		sc_sync_peer;
 	uint32_t		sc_flags;
-#define	PFSYNCF_OK		0x00000001
-#define	PFSYNCF_DEFER		0x00000002
 	uint8_t			sc_maxupdates;
 	struct ip		sc_template;
 	struct mtx		sc_mtx;
@@ -1375,8 +1373,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		}
 		pfsyncr.pfsyncr_syncpeer = sc->sc_sync_peer;
 		pfsyncr.pfsyncr_maxupdates = sc->sc_maxupdates;
-		pfsyncr.pfsyncr_defer = (PFSYNCF_DEFER ==
-		    (sc->sc_flags & PFSYNCF_DEFER));
+		pfsyncr.pfsyncr_defer = sc->sc_flags;
 		PFSYNC_UNLOCK(sc);
 		return (copyout(&pfsyncr, ifr_data_get_ptr(ifr),
 		    sizeof(pfsyncr)));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104261449.13QEnlSJ032407>