Wed Apr 22 23:55:29 2020 UTC ()
Let loop.c own iflist


(joerg)
diff -r1.12 -r1.13 src/usr.sbin/mopd/common/loop-bsd.c
diff -r1.2 -r1.3 src/usr.sbin/mopd/common/loop-linux2.c

cvs diff -r1.12 -r1.13 src/usr.sbin/mopd/common/loop-bsd.c (expand / switch to unified diff)

--- src/usr.sbin/mopd/common/loop-bsd.c 2016/06/08 01:11:49 1.12
+++ src/usr.sbin/mopd/common/loop-bsd.c 2020/04/22 23:55:29 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: loop-bsd.c,v 1.12 2016/06/08 01:11:49 christos Exp $ */ 1/* $NetBSD: loop-bsd.c,v 1.13 2020/04/22 23:55:29 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. 4 * Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#include "port.h" 27#include "port.h"
28#ifndef lint 28#ifndef lint
29__RCSID("$NetBSD: loop-bsd.c,v 1.12 2016/06/08 01:11:49 christos Exp $"); 29__RCSID("$NetBSD: loop-bsd.c,v 1.13 2020/04/22 23:55:29 joerg Exp $");
30#endif 30#endif
31 31
32#include <errno.h> 32#include <errno.h>
33#include <stdlib.h> 33#include <stdlib.h>
34#include <strings.h> 34#include <strings.h>
35#include <unistd.h> 35#include <unistd.h>
36#if defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__) 36#if defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__)
37#include <sys/time.h> 37#include <sys/time.h>
38#endif 38#endif
39#include <net/bpf.h> 39#include <net/bpf.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41#include <sys/poll.h> 41#include <sys/poll.h>
42#include <assert.h> 42#include <assert.h>
@@ -77,27 +77,27 @@ void @@ -77,27 +77,27 @@ void
77mopReadRC(void) 77mopReadRC(void)
78{ 78{
79} 79}
80 80
81void 81void
82mopReadDL(void) 82mopReadDL(void)
83{ 83{
84} 84}
85 85
86/* 86/*
87 * The list of all interfaces that are being listened to. loop() 87 * The list of all interfaces that are being listened to. loop()
88 * "polls" on the descriptors in this list. 88 * "polls" on the descriptors in this list.
89 */ 89 */
90struct if_info *iflist; 90extern struct if_info *iflist;
91 91
92void mopProcess(struct if_info *, u_char *); 92void mopProcess(struct if_info *, u_char *);
93 93
94/* 94/*
95 * Loop indefinitely listening for MOP requests on the 95 * Loop indefinitely listening for MOP requests on the
96 * interfaces in 'iflist'. 96 * interfaces in 'iflist'.
97 */ 97 */
98void 98void
99Loop(void) 99Loop(void)
100{ 100{
101 u_char *buf, *bp, *ep; 101 u_char *buf, *bp, *ep;
102 int cc, n, m; 102 int cc, n, m;
103 struct pollfd *set; 103 struct pollfd *set;

cvs diff -r1.2 -r1.3 src/usr.sbin/mopd/common/loop-linux2.c (expand / switch to unified diff)

--- src/usr.sbin/mopd/common/loop-linux2.c 2019/12/07 04:55:01 1.2
+++ src/usr.sbin/mopd/common/loop-linux2.c 2020/04/22 23:55:29 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: loop-linux2.c,v 1.2 2019/12/07 04:55:01 christos Exp $ */ 1/* $NetBSD: loop-linux2.c,v 1.3 2020/04/22 23:55:29 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. 4 * Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#include "port.h" 27#include "port.h"
28#ifndef lint 28#ifndef lint
29__RCSID("$NetBSD: loop-linux2.c,v 1.2 2019/12/07 04:55:01 christos Exp $"); 29__RCSID("$NetBSD: loop-linux2.c,v 1.3 2020/04/22 23:55:29 joerg Exp $");
30#endif 30#endif
31 31
32#include <stdlib.h> 32#include <stdlib.h>
33#include <strings.h> 33#include <strings.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <errno.h> 35#include <errno.h>
36#if defined(__bsdi__) || defined(__FreeBSD__) 36#if defined(__bsdi__) || defined(__FreeBSD__)
37#include <sys/time.h> 37#include <sys/time.h>
38#endif 38#endif
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40 40
41#include "os.h" 41#include "os.h"
42#include "common.h" 42#include "common.h"
@@ -72,27 +72,27 @@ void @@ -72,27 +72,27 @@ void
72mopReadRC(void) 72mopReadRC(void)
73{ 73{
74} 74}
75 75
76void 76void
77mopReadDL(void) 77mopReadDL(void)
78{ 78{
79} 79}
80 80
81/* 81/*
82 * The list of all interfaces that are being listened to. loop() 82 * The list of all interfaces that are being listened to. loop()
83 * "selects" on the descriptors in this list. 83 * "selects" on the descriptors in this list.
84 */ 84 */
85struct if_info *iflist; 85extern struct if_info *iflist;
86 86
87void mopProcess(struct if_info *, u_char *); 87void mopProcess(struct if_info *, u_char *);
88 88
89/* 89/*
90 * Loop indefinitely listening for MOP requests on the 90 * Loop indefinitely listening for MOP requests on the
91 * interfaces in 'iflist'. 91 * interfaces in 'iflist'.
92 */ 92 */
93void 93void
94Loop(void) 94Loop(void)
95{ 95{
96 u_char *buf, *bp, *ep; 96 u_char *buf, *bp, *ep;
97 int cc; 97 int cc;
98 fd_set fds, listeners; 98 fd_set fds, listeners;