Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/route Add a prog_setsockopt (thanks kre@)



details:   https://anonhg.NetBSD.org/src/rev/23ff0f27fcbf
branches:  trunk
changeset: 1008773:23ff0f27fcbf
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 02 18:32:31 2020 +0000

description:
Add a prog_setsockopt (thanks kre@)

diffstat:

 sbin/route/prog_ops.h      |  22 ++++++++++++++++++----
 sbin/route/route.c         |   6 +++---
 sbin/route/route_hostops.c |  21 ++++++++++++---------
 sbin/route/route_rumpops.c |  22 ++++++++++++----------
 4 files changed, 45 insertions(+), 26 deletions(-)

diffs (178 lines):

diff -r 7aaaa5efb0a5 -r 23ff0f27fcbf sbin/route/prog_ops.h
--- a/sbin/route/prog_ops.h     Thu Apr 02 17:41:33 2020 +0000
+++ b/sbin/route/prog_ops.h     Thu Apr 02 18:32:31 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: prog_ops.h,v 1.3 2014/11/06 21:29:32 christos Exp $   */
+/*      $NetBSD: prog_ops.h,v 1.4 2020/04/02 18:32:31 christos Exp $   */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,36 +36,50 @@
 struct prog_ops {
        int (*op_init)(void);
 
-       int (*op_sysctl)(const int *, u_int, void *, size_t *,
-                        const void *, size_t);
+       int (*op_socket)(int, int, int);
+       int (*op_setsockopt)(int, int, int, const void *, socklen_t);
 
-       int (*op_socket)(int, int, int);
+
        int (*op_open)(const char *, int, ...);
        pid_t (*op_getpid)(void);
 
        ssize_t (*op_read)(int, void *, size_t);
        ssize_t (*op_write)(int, const void *, size_t);
 
+       int (*op_sysctl)(const int *, u_int, void *, size_t *,
+                        const void *, size_t);
 
        int (*op_shutdown)(int, int);
 };
 extern const struct prog_ops prog_ops;
 
 #define prog_init prog_ops.op_init
+
 #define prog_socket prog_ops.op_socket
+#define prog_setsockopt prog_ops.op_setsockopt
+
 #define prog_open prog_ops.op_open
 #define prog_getpid prog_ops.op_getpid
+
 #define prog_read prog_ops.op_read
 #define prog_write prog_ops.op_write
+
 #define prog_sysctl prog_ops.op_sysctl
+
 #define prog_shutdown prog_ops.op_shutdown
+
 #else
 #define prog_init ((int (*)(void))NULL)
+
 #define prog_socket socket
+#define prog_setsockopt setsockopt
+
 #define prog_open open
 #define prog_getpid getpid
+
 #define prog_read read
 #define prog_write write
+
 #define prog_sysctl sysctl
 #define prog_shutdown shutdown
 #endif
diff -r 7aaaa5efb0a5 -r 23ff0f27fcbf sbin/route/route.c
--- a/sbin/route/route.c        Thu Apr 02 17:41:33 2020 +0000
+++ b/sbin/route/route.c        Thu Apr 02 18:32:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.167 2020/03/14 22:26:39 roy Exp $  */
+/*     $NetBSD: route.c,v 1.168 2020/04/02 18:32:31 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)route.c    8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.167 2020/03/14 22:26:39 roy Exp $");
+__RCSID("$NetBSD: route.c,v 1.168 2020/04/02 18:32:31 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -212,7 +212,7 @@
                int on = 1;
 
                sock = prog_socket(PF_ROUTE, SOCK_RAW, 0);
-               if (setsockopt(sock, SOL_SOCKET, SO_RERROR,
+               if (prog_setsockopt(sock, SOL_SOCKET, SO_RERROR,
                    &on, sizeof(on)) == -1)
                        warn("SO_RERROR");
        }
diff -r 7aaaa5efb0a5 -r 23ff0f27fcbf sbin/route/route_hostops.c
--- a/sbin/route/route_hostops.c        Thu Apr 02 17:41:33 2020 +0000
+++ b/sbin/route/route_hostops.c        Thu Apr 02 18:32:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route_hostops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $  */
+/*     $NetBSD: route_hostops.c,v 1.2 2020/04/02 18:32:31 christos Exp $       */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: route_hostops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
+__RCSID("$NetBSD: route_hostops.c,v 1.2 2020/04/02 18:32:31 christos Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -41,14 +41,17 @@
 #include "prog_ops.h"
 
 const struct prog_ops prog_ops = {
-       .op_socket = socket,
-       .op_open = open,
-       .op_getpid = getpid,
+
+       .op_socket =            socket,
+       .op_setsockopt =        setsockopt,
+
+       .op_open =              open,
+       .op_getpid =            getpid,
 
-       .op_read = read,
-       .op_write = write,
+       .op_read =              read,
+       .op_write =             write,
 
-       .op_sysctl = sysctl,
+       .op_sysctl =            sysctl,
 
-       .op_shutdown = shutdown,
+       .op_shutdown =          shutdown,
 };
diff -r 7aaaa5efb0a5 -r 23ff0f27fcbf sbin/route/route_rumpops.c
--- a/sbin/route/route_rumpops.c        Thu Apr 02 17:41:33 2020 +0000
+++ b/sbin/route/route_rumpops.c        Thu Apr 02 18:32:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route_rumpops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $  */
+/*     $NetBSD: route_rumpops.c,v 1.2 2020/04/02 18:32:31 christos Exp $       */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: route_rumpops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
+__RCSID("$NetBSD: route_rumpops.c,v 1.2 2020/04/02 18:32:31 christos Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -43,16 +43,18 @@
 #include "prog_ops.h"
 
 const struct prog_ops prog_ops = {
-       .op_init =      rumpclient_init,
+       .op_init =              rumpclient_init,
 
-       .op_socket =    rump_sys_socket,
-       .op_open =      rump_sys_open,
-       .op_getpid =    rump_sys_getpid,
+       .op_socket =            rump_sys_socket,
+       .op_setsockopt =        rump_sys_setsockopt,
+
+       .op_open =              rump_sys_open,
+       .op_getpid =            rump_sys_getpid,
 
-       .op_read =      rump_sys_read,
-       .op_write =     rump_sys_write,
+       .op_read =              rump_sys_read,
+       .op_write =             rump_sys_write,
 
-       .op_sysctl =    rump_sys___sysctl,
+       .op_sysctl =            rump_sys___sysctl,
 
-       .op_shutdown =  rump_sys_shutdown,
+       .op_shutdown =          rump_sys_shutdown,
 };



Home | Main Index | Thread Index | Old Index