Date: Tue, 3 Apr 2012 18:10:48 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r233847 - head/sbin/ifconfig Message-ID: <201204031810.q33IAmWh062261@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Tue Apr 3 18:10:48 2012 New Revision: 233847 URL: http://svn.freebsd.org/changeset/base/233847 Log: Make it possible to switch pfsync(4) deferral mechanism on/off. Obtained from: OpenBSD Modified: head/sbin/ifconfig/ifpfsync.c Modified: head/sbin/ifconfig/ifpfsync.c ============================================================================== --- head/sbin/ifconfig/ifpfsync.c Tue Apr 3 18:09:20 2012 (r233846) +++ head/sbin/ifconfig/ifpfsync.c Tue Apr 3 18:10:48 2012 (r233847) @@ -52,6 +52,7 @@ void setpfsync_syncpeer(const char *, in void unsetpfsync_syncpeer(const char *, int, int, const struct afswtch *); void setpfsync_syncpeer(const char *, int, int, const struct afswtch *); void setpfsync_maxupd(const char *, int, int, const struct afswtch *); +void setpfsync_defer(const char *, int, int, const struct afswtch *); void pfsync_status(int); void @@ -162,6 +163,23 @@ setpfsync_maxupd(const char *val, int d, err(1, "SIOCSETPFSYNC"); } +/* ARGSUSED */ +void +setpfsync_defer(const char *val, int d, int s, const struct afswtch *rafp) +{ + struct pfsyncreq preq; + + memset((char *)&preq, 0, sizeof(struct pfsyncreq)); + ifr.ifr_data = (caddr_t)&preq; + + if (ioctl(s, SIOCGETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCGETPFSYNC"); + + preq.pfsyncr_defer = d; + if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCSETPFSYNC"); +} + void pfsync_status(int s) { @@ -183,8 +201,10 @@ pfsync_status(int s) printf("syncpeer: %s ", inet_ntoa(preq.pfsyncr_syncpeer)); if (preq.pfsyncr_syncdev[0] != '\0' || - preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) - printf("maxupd: %d\n", preq.pfsyncr_maxupdates); + preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) { + printf("maxupd: %d ", preq.pfsyncr_maxupdates); + printf("defer: %s\n", preq.pfsyncr_defer ? "on" : "off"); + } } static struct cmd pfsync_cmds[] = { @@ -194,7 +214,9 @@ static struct cmd pfsync_cmds[] = { DEF_CMD("-syncif", 1, unsetpfsync_syncdev), DEF_CMD_ARG("syncpeer", setpfsync_syncpeer), DEF_CMD("-syncpeer", 1, unsetpfsync_syncpeer), - DEF_CMD_ARG("maxupd", setpfsync_maxupd) + DEF_CMD_ARG("maxupd", setpfsync_maxupd), + DEF_CMD("defer", 1, setpfsync_defer), + DEF_CMD("-defer", 0, setpfsync_defer), }; static struct afswtch af_pfsync = { .af_name = "af_pfsync",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204031810.q33IAmWh062261>