dispatch_imsg() only needs to know name and rdomain.
authorkrw <krw@openbsd.org>
Fri, 7 Jul 2017 15:39:30 +0000 (15:39 +0000)
committerkrw <krw@openbsd.org>
Fri, 7 Jul 2017 15:39:30 +0000 (15:39 +0000)
No more struct interface_info knowledge in privsep.[ch]

sbin/dhclient/dhclient.c
sbin/dhclient/privsep.c
sbin/dhclient/privsep.h

index 94659f6..940049c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhclient.c,v 1.457 2017/07/07 14:53:06 krw Exp $      */
+/*     $OpenBSD: dhclient.c,v 1.458 2017/07/07 15:39:30 krw Exp $      */
 
 /*
  * Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -2091,7 +2091,8 @@ fork_privchld(struct interface_info *ifi, int fd, int fd2)
                        continue;
                }
 
-               got_imsg_hup = dispatch_imsg(ifi, ioctlfd, routefd, priv_ibuf);
+               got_imsg_hup = dispatch_imsg(ifi->name, ifi->rdomain, ioctlfd,
+                   routefd, priv_ibuf);
                if (got_imsg_hup)
                        quit = SIGHUP;
        }
index 09ffe76..4bb0195 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: privsep.c,v 1.54 2017/07/02 09:11:13 krw Exp $ */
+/*     $OpenBSD: privsep.c,v 1.55 2017/07/07 15:39:30 krw Exp $ */
 
 /*
  * Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -36,7 +36,7 @@
 #include "privsep.h"
 
 int
-dispatch_imsg(struct interface_info *ifi, int ioctlfd, int routefd,
+dispatch_imsg(char *name, int rdomain, int ioctlfd, int routefd,
     struct imsgbuf *ibuf)
 {
        struct imsg     imsg;
@@ -55,8 +55,7 @@ dispatch_imsg(struct interface_info *ifi, int ioctlfd, int routefd,
                            sizeof(struct imsg_delete_address))
                                log_warnx("bad IMSG_DELETE_ADDRESS");
                        else
-                               priv_delete_address(ifi->name, ioctlfd,
-                                   imsg.data);
+                               priv_delete_address(name, ioctlfd, imsg.data);
                        break;
 
                case IMSG_ADD_ADDRESS:
@@ -64,15 +63,14 @@ dispatch_imsg(struct interface_info *ifi, int ioctlfd, int routefd,
                            sizeof(struct imsg_add_address))
                                log_warnx("bad IMSG_ADD_ADDRESS");
                        else
-                               priv_add_address(ifi->name, ioctlfd, imsg.data);
+                               priv_add_address(name, ioctlfd, imsg.data);
                        break;
 
                case IMSG_FLUSH_ROUTES:
                        if (imsg.hdr.len != IMSG_HEADER_SIZE)
                                log_warnx("bad IMSG_FLUSH_ROUTES");
                        else
-                               priv_flush_routes(ifi->name, routefd,
-                                   ifi->rdomain);
+                               priv_flush_routes(name, routefd, rdomain);
                        break;
 
                case IMSG_ADD_ROUTE:
@@ -80,7 +78,7 @@ dispatch_imsg(struct interface_info *ifi, int ioctlfd, int routefd,
                            sizeof(struct imsg_add_route))
                                log_warnx("bad IMSG_ADD_ROUTE");
                        else
-                               priv_add_route(ifi->rdomain, imsg.data);
+                               priv_add_route(rdomain, imsg.data);
                        break;
 
                case IMSG_SET_INTERFACE_MTU:
@@ -88,14 +86,14 @@ dispatch_imsg(struct interface_info *ifi, int ioctlfd, int routefd,
                            sizeof(struct imsg_set_interface_mtu))
                                log_warnx("bad IMSG_SET_INTERFACE_MTU");
                        else
-                               priv_set_interface_mtu(ifi->name, ioctlfd,
+                               priv_set_interface_mtu(name, ioctlfd,
                                    imsg.data);
                        break;
 
                case IMSG_WRITE_RESOLV_CONF:
                        if (imsg.hdr.len <= IMSG_HEADER_SIZE)
                                log_warnx("short IMSG_WRITE_RESOLV_CONF");
-                       else if (resolv_conf_priority(ifi->rdomain, routefd))
+                       else if (resolv_conf_priority(rdomain, routefd))
                                priv_write_resolv_conf(imsg.data,
                                    imsg.hdr.len - IMSG_HEADER_SIZE);
                        break;
index c4775e1..c2b0ab4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: privsep.h,v 1.41 2017/07/01 23:27:56 krw Exp $ */
+/*     $OpenBSD: privsep.h,v 1.42 2017/07/07 15:39:30 krw Exp $ */
 
 /*
  * Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -49,7 +49,7 @@ struct imsg_set_interface_mtu {
        int     mtu;
 };
 
-int    dispatch_imsg(struct interface_info *, int, int, struct imsgbuf *);
+int    dispatch_imsg(char *, int, int, int, struct imsgbuf *);
 
 void   add_direct_route(struct in_addr, struct in_addr, struct in_addr);
 void   add_default_route(struct in_addr, struct in_addr);