Index: Makefile =================================================================== RCS file: /usr/store/mlaier/fcvs/src/sbin/ifconfig/Makefile,v retrieving revision 1.25 diff -u -r1.25 Makefile --- Makefile 23 Feb 2004 20:13:52 -0000 1.25 +++ Makefile 18 Jun 2004 20:07:43 -0000 @@ -21,6 +21,12 @@ SRCS+= ifmac.c CFLAGS+=-DUSE_MAC +#comment out to exclude PFSYNC support +.if !defined(NO_PF) +SRCS+= ifpfsync.c +CFLAGS+=-DUSE_PFSYNC +.endif + MAN= ifconfig.8 .if defined(RELEASE_CRUNCH) Index: ifconfig.c =================================================================== RCS file: /usr/store/mlaier/fcvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.104 diff -u -r1.104 ifconfig.c --- ifconfig.c 30 Apr 2004 22:34:12 -0000 1.104 +++ ifconfig.c 18 Jun 2004 20:07:43 -0000 @@ -240,6 +240,11 @@ { "mediaopt", NEXTARG, setmediaopt }, { "-mediaopt", NEXTARG, unsetmediaopt }, #endif +#ifdef USE_PFSYNC + { "syncif", NEXTARG, setpfsync_syncif }, + { "maxupd", NEXTARG, setpfsync_maxupd }, + { "-syncif", 1, unsetpfsync_syncif }, +#endif #ifdef USE_VLANS { "vlan", NEXTARG, setvlantag }, { "vlandev", NEXTARG, setvlandev }, @@ -1154,6 +1159,10 @@ #ifdef USE_IF_MEDIA if (allfamilies || afp->af_status == media_status) media_status(s, NULL); +#endif +#ifdef USE_PFSYNC + if (allfamilies || afp->af_status == pfsync_status) + pfsync_status(s, NULL); #endif #ifdef USE_VLANS if (allfamilies || afp->af_status == vlan_status) Index: ifconfig.h =================================================================== RCS file: /usr/store/mlaier/fcvs/src/sbin/ifconfig/ifconfig.h,v retrieving revision 1.12 diff -u -r1.12 ifconfig.h --- ifconfig.h 30 Mar 2004 22:59:22 -0000 1.12 +++ ifconfig.h 18 Jun 2004 20:07:43 -0000 @@ -70,3 +70,8 @@ extern void ieee80211_status(int s, struct rt_addrinfo *); extern void maclabel_status(int s, struct rt_addrinfo *); extern void setifmaclabel(const char *, int, int, const struct afswtch *rafp); + +extern void setpfsync_syncif(const char *, int, int, const struct afswtch *rafp); +extern void unsetpfsync_syncif(const char *, int, int, const struct afswtch *rafp); +extern void setpfsync_maxupd(const char *, int, int, const struct afswtch *rafp); +extern void pfsync_status(int, struct rt_addrinfo *); Index: ifpfsync.c =================================================================== RCS file: ifpfsync.c diff -N ifpfsync.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ifpfsync.c 18 Jun 2004 20:07:43 -0000 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2003 Ryan McBride. All rights reserved. + * Copyright (c) 2004 Max Laier. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +void +setpfsync_syncif(const char *val, int d, int s, const struct afswtch *rafp) +{ + struct pfsyncreq preq; + + bzero((char *)&preq, sizeof(struct pfsyncreq)); + ifr.ifr_data = (caddr_t)&preq; + + if (ioctl(s, SIOCGETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCGETPFSYNC"); + + strlcpy(preq.pfsyncr_syncif, val, sizeof(preq.pfsyncr_syncif)); + + if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCSETPFSYNC"); +} + +void +unsetpfsync_syncif(const char *val, int d, int s, const struct afswtch *rafp) +{ + struct pfsyncreq preq; + + bzero((char *)&preq, sizeof(struct pfsyncreq)); + ifr.ifr_data = (caddr_t)&preq; + + if (ioctl(s, SIOCGETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCGETPFSYNC"); + + bzero((char *)&preq.pfsyncr_syncif, sizeof(preq.pfsyncr_syncif)); + + if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCSETPFSYNC"); +} + +void +setpfsync_maxupd(const char *val, int d, int s, const struct afswtch *rafp) +{ + int maxupdates; + struct pfsyncreq preq; + + maxupdates = atoi(val); + + 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_maxupdates = maxupdates; + + if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) + err(1, "SIOCSETPFSYNC"); +} + +void +pfsync_status(int s, struct rt_addrinfo *info __unused) +{ + struct pfsyncreq preq; + + bzero((char *)&preq, sizeof(struct pfsyncreq)); + ifr.ifr_data = (caddr_t)&preq; + + if (ioctl(s, SIOCGETPFSYNC, (caddr_t)&ifr) == -1) + return; + + if (preq.pfsyncr_syncif[0] != '\0') { + printf("\tpfsync: syncif: %s maxupd: %d\n", + preq.pfsyncr_syncif, preq.pfsyncr_maxupdates); + } +}