2003-08-17 11:11:32 +00:00
|
|
|
/* $KAME: rtsold.h,v 1.19 2003/04/16 09:48:15 itojun Exp $ */
|
2000-10-06 23:46:52 +00:00
|
|
|
|
2017-11-20 19:49:47 +00:00
|
|
|
/*-
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
1999-12-28 02:37:14 +00:00
|
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
|
|
|
* All rights reserved.
|
2000-07-05 10:14:11 +00:00
|
|
|
*
|
1999-12-28 02:37:14 +00:00
|
|
|
* 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.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
2000-07-05 10:14:11 +00:00
|
|
|
*
|
1999-12-28 02:37:14 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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$
|
|
|
|
*/
|
|
|
|
|
2011-06-06 03:06:43 +00:00
|
|
|
struct script_msg {
|
|
|
|
TAILQ_ENTRY(script_msg) sm_next;
|
|
|
|
|
|
|
|
char *sm_msg;
|
|
|
|
};
|
|
|
|
|
2011-09-12 23:55:23 +00:00
|
|
|
TAILQ_HEAD(script_msg_head_t, script_msg);
|
|
|
|
|
2011-06-06 03:06:43 +00:00
|
|
|
struct ra_opt {
|
|
|
|
TAILQ_ENTRY(ra_opt) rao_next;
|
|
|
|
|
|
|
|
u_int8_t rao_type;
|
2013-08-05 20:13:02 +00:00
|
|
|
struct timespec rao_expire;
|
2011-06-06 03:06:43 +00:00
|
|
|
size_t rao_len;
|
|
|
|
void *rao_msg;
|
|
|
|
};
|
|
|
|
|
2011-06-08 16:03:29 +00:00
|
|
|
TAILQ_HEAD(rainfo_head, ra_opt);
|
|
|
|
|
|
|
|
struct rainfo {
|
|
|
|
TAILQ_ENTRY(rainfo) rai_next;
|
|
|
|
|
|
|
|
struct ifinfo *rai_ifinfo;
|
|
|
|
struct sockaddr_in6 rai_saddr;
|
|
|
|
TAILQ_HEAD(, ra_opt) rai_ra_opt;
|
|
|
|
};
|
|
|
|
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
/* Per-interface tracking info. */
|
1999-12-28 02:37:14 +00:00
|
|
|
struct ifinfo {
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
TAILQ_ENTRY(ifinfo) ifi_next; /* pointer to the next interface */
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
struct sockaddr_dl *sdl; /* link-layer address */
|
2011-09-12 23:55:23 +00:00
|
|
|
char ifname[IFNAMSIZ]; /* interface name */
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
uint32_t linkid; /* link ID of this interface */
|
1999-12-28 02:37:14 +00:00
|
|
|
int active; /* interface status */
|
2003-08-08 16:56:01 +00:00
|
|
|
int probeinterval; /* interval of probe timer (if necessary) */
|
1999-12-28 02:37:14 +00:00
|
|
|
int probetimer; /* rest of probe timer */
|
2015-10-21 05:37:09 +00:00
|
|
|
int mediareqok; /* whether the IF supports SIOCGIFMEDIA */
|
2020-08-25 16:09:23 +00:00
|
|
|
int managedconfig; /* need a separate protocol for the "managed"
|
|
|
|
* configuration */
|
2003-08-08 16:42:37 +00:00
|
|
|
int otherconfig; /* need a separate protocol for the "other"
|
|
|
|
* configuration */
|
1999-12-28 02:37:14 +00:00
|
|
|
int state;
|
|
|
|
int probes;
|
|
|
|
int dadcount;
|
2013-08-05 20:13:02 +00:00
|
|
|
struct timespec timer;
|
|
|
|
struct timespec expire;
|
2011-06-08 16:03:29 +00:00
|
|
|
#define IFI_DNSOPT_STATE_NOINFO 0
|
|
|
|
#define IFI_DNSOPT_STATE_RECEIVED 1
|
|
|
|
int ifi_rdnss; /* RDNSS option state */
|
|
|
|
int ifi_dnssl; /* DNSSL option state */
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
int racnt; /* total # of valid RAs it have got */
|
2011-06-08 16:03:29 +00:00
|
|
|
TAILQ_HEAD(, rainfo) ifi_rainfo;
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
size_t rs_datalen;
|
|
|
|
u_char *rs_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* per interface status */
|
2000-07-05 10:14:11 +00:00
|
|
|
#define IFS_IDLE 0
|
|
|
|
#define IFS_DELAY 1
|
|
|
|
#define IFS_PROBE 2
|
|
|
|
#define IFS_DOWN 3
|
|
|
|
#define IFS_TENTATIVE 4
|
1999-12-28 02:37:14 +00:00
|
|
|
|
2011-06-06 03:06:43 +00:00
|
|
|
/* Interface list */
|
|
|
|
extern TAILQ_HEAD(ifinfo_head_t, ifinfo) ifinfo_head;
|
|
|
|
|
2011-09-12 23:55:23 +00:00
|
|
|
#define DNSINFO_ORIGIN_LABEL "slaac"
|
2011-06-06 03:06:43 +00:00
|
|
|
/*
|
|
|
|
* RFC 3542 API deprecates IPV6_PKTINFO in favor of
|
|
|
|
* IPV6_RECVPKTINFO
|
|
|
|
*/
|
|
|
|
#ifndef IPV6_RECVPKTINFO
|
|
|
|
#ifdef IPV6_PKTINFO
|
|
|
|
#define IPV6_RECVPKTINFO IPV6_PKTINFO
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* RFC 3542 API deprecates IPV6_HOPLIMIT in favor of
|
|
|
|
* IPV6_RECVHOPLIMIT
|
|
|
|
*/
|
|
|
|
#ifndef IPV6_RECVHOPLIMIT
|
|
|
|
#ifdef IPV6_HOPLIMIT
|
|
|
|
#define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef IN6ADDR_LINKLOCAL_ALLROUTERS_INIT
|
|
|
|
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
|
|
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
|
|
|
#endif
|
|
|
|
|
2013-08-05 20:13:02 +00:00
|
|
|
#define TS_CMP(tsp, usp, cmp) \
|
|
|
|
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
|
|
|
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
|
|
|
((tsp)->tv_sec cmp (usp)->tv_sec))
|
|
|
|
#define TS_ADD(tsp, usp, vsp) \
|
|
|
|
do { \
|
|
|
|
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
|
|
|
|
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
|
|
|
|
if ((vsp)->tv_nsec >= 1000000000L) { \
|
|
|
|
(vsp)->tv_sec++; \
|
|
|
|
(vsp)->tv_nsec -= 1000000000L; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#define TS_SUB(tsp, usp, vsp) \
|
|
|
|
do { \
|
|
|
|
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
|
|
|
|
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
|
|
|
|
if ((vsp)->tv_nsec < 0) { \
|
|
|
|
(vsp)->tv_sec--; \
|
|
|
|
(vsp)->tv_nsec += 1000000000L; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
1999-12-28 02:37:14 +00:00
|
|
|
/* rtsold.c */
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
struct cap_channel;
|
2013-08-05 20:13:02 +00:00
|
|
|
extern struct timespec tm_max;
|
1999-12-28 02:37:14 +00:00
|
|
|
extern int dflag;
|
2003-08-17 11:11:32 +00:00
|
|
|
extern int aflag;
|
2009-09-12 22:14:58 +00:00
|
|
|
extern int Fflag;
|
2011-09-12 23:55:23 +00:00
|
|
|
extern int uflag;
|
2020-08-25 16:09:23 +00:00
|
|
|
extern const char *managedconf_script;
|
2011-06-06 03:06:43 +00:00
|
|
|
extern const char *otherconf_script;
|
|
|
|
extern const char *resolvconf_script;
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
extern struct cap_channel *capllflags, *capscript, *capsendmsg, *capsyslog;
|
|
|
|
|
2007-11-07 10:53:41 +00:00
|
|
|
struct ifinfo *find_ifinfo(int);
|
2011-06-08 16:03:29 +00:00
|
|
|
struct rainfo *find_rainfo(struct ifinfo *, struct sockaddr_in6 *);
|
2007-11-07 10:53:41 +00:00
|
|
|
void rtsol_timer_update(struct ifinfo *);
|
|
|
|
extern void warnmsg(int, const char *, const char *, ...)
|
2000-10-06 23:46:52 +00:00
|
|
|
__attribute__((__format__(__printf__, 3, 4)));
|
2011-06-06 03:06:43 +00:00
|
|
|
extern int ra_opt_handler(struct ifinfo *);
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
/* if.c */
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
struct nd_opt_hdr;
|
2007-11-07 10:53:41 +00:00
|
|
|
extern int ifinit(void);
|
|
|
|
extern int interface_up(char *);
|
|
|
|
extern int interface_status(struct ifinfo *);
|
|
|
|
extern int lladdropt_length(struct sockaddr_dl *);
|
|
|
|
extern void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
|
|
|
|
extern struct sockaddr_dl *if_nametosdl(char *);
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
/* rtsol.c */
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
extern int recvsockopen(void);
|
2007-11-07 10:53:41 +00:00
|
|
|
extern void rtsol_input(int);
|
1999-12-28 02:37:14 +00:00
|
|
|
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
/* cap_llflags.c */
|
|
|
|
extern int cap_llflags_get(struct cap_channel *, const char *, int *);
|
|
|
|
|
|
|
|
/* cap_script.c */
|
|
|
|
extern int cap_script_run(struct cap_channel *, const char *const *);
|
|
|
|
extern int cap_script_wait(struct cap_channel *, int *);
|
|
|
|
|
|
|
|
/* cap_sendmsg.c */
|
|
|
|
extern int cap_probe_defrouters(struct cap_channel *, struct ifinfo *);
|
|
|
|
extern int cap_rssend(struct cap_channel *, struct ifinfo *);
|
1999-12-28 02:37:14 +00:00
|
|
|
|
|
|
|
/* dump.c */
|
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they
are good candidates for sandboxing.
The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox. In particular, several custom services
were required.
- A Casper service is used to send Router Solicitation messages on a
raw ICMP6 socket. Initially I took the approach of creating a
socket for each interface upon startup, and connect(2)ing it to
the all-routers multicast group for the interface. This permits
the use of sendmsg(2) in capability mode, but only works if the
interface's link is up when rtsol(d) starts. So, instead, the
rtsold.sendmsg service is used to transmit RS messages on behalf
of the main process. One could alternately define a service
which simply creates and connects a socket for each destination
address, and returns the socket to the sandboxed process. However,
to implement rtsold's -m option we also need to read the ND6 default
router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
options in received RA messages. A Casper service is used to
fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
link-local address is useable (i.e., not duplicated or undergoing
DAD). This information is supplied by getifaddrs(3), which reads
a sysctl not available in capability mode. The SIOCGIFCONF socket
ioctl provides equivalent information and can be used in capability
mode, but I decided against it for now because of some limitations
of that interface.
In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.
Reviewed by: oshogbo
Tested by: bz (previous versions)
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
|
|
|
extern FILE *rtsold_init_dumpfile(const char *);
|
|
|
|
extern void rtsold_dump(FILE *);
|
2013-08-05 20:13:02 +00:00
|
|
|
extern const char *sec2str(const struct timespec *);
|
2001-06-11 12:39:29 +00:00
|
|
|
|
|
|
|
/* rtsock.c */
|
2007-11-07 10:53:41 +00:00
|
|
|
extern int rtsock_open(void);
|
|
|
|
extern int rtsock_input(int);
|