summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-09-09 05:59:18 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-09-21 16:02:20 +0200
commitcae8bc967cf7c93b7924ae4aaa05a99dfe345c78 (patch)
treec7de335da42ae46a645cecee414b85c8f991f79e /lib
parentMerge pull request #7036 from ton31337/fix/do_not_allow_setting_maximum-prefi... (diff)
downloadfrr-cae8bc967cf7c93b7924ae4aaa05a99dfe345c78.tar.xz
frr-cae8bc967cf7c93b7924ae4aaa05a99dfe345c78.zip
*: Remove solaris from FRR
The Solaris code has gone through a deprecation cycle. No-one has said anything to us and worse of all we don't have any test systems running Solaris to know if we are making changes that are breaking on Solaris. Remove it from the system so we can clean up a bit. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c42
-rw-r--r--lib/netns_other.c4
-rw-r--r--lib/prefix.h9
-rw-r--r--lib/privs.c297
-rw-r--r--lib/sigevent.c2
-rw-r--r--lib/sockopt.c51
-rw-r--r--lib/sockopt.h4
-rw-r--r--lib/vty.c9
-rw-r--r--lib/zebra.h18
9 files changed, 11 insertions, 425 deletions
diff --git a/lib/if.c b/lib/if.c
index 10db574dc..304840e5b 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -802,44 +802,6 @@ void if_dump_all(void)
if_dump(ifp);
}
-#ifdef SUNOS_5
-/* Need to handle upgrade from SUNWzebra to Quagga. SUNWzebra created
- * a seperate struct interface for each logical interface, so config
- * file may be full of 'interface fooX:Y'. Solaris however does not
- * expose logical interfaces via PF_ROUTE, so trying to track logical
- * interfaces can be fruitless, for that reason Quagga only tracks
- * the primary IP interface.
- *
- * We try accomodate SUNWzebra by:
- * - looking up the interface name, to see whether it exists, if so
- * its useable
- * - for protocol daemons, this could only because zebra told us of
- * the interface
- * - for zebra, only because it learnt from kernel
- * - if not:
- * - search the name to see if it contains a sub-ipif / logical interface
- * seperator, the ':' char. If it does:
- * - text up to that char must be the primary name - get that name.
- * if not:
- * - no idea, just get the name in its entirety.
- */
-static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id)
-{
- struct interface *ifp;
- char *cp;
-
- if ((ifp = if_lookup_by_name(name, vrf_id)) != NULL)
- return ifp;
-
- /* hunt the primary interface name... */
- cp = strchr(name, ':');
- if (cp)
- *cp = '\0';
-
- return if_get_by_name(name, vrf_id);
-}
-#endif /* SUNOS_5 */
-
#if 0
/* For debug purpose. */
DEFUN (show_address,
@@ -1554,11 +1516,7 @@ static int lib_interface_create(struct nb_cb_create_args *args)
case NB_EV_APPLY:
vrf = vrf_lookup_by_name(vrfname);
assert(vrf);
-#ifdef SUNOS_5
- ifp = if_sunwzebra_get(ifname, vrf->vrf_id);
-#else
ifp = if_get_by_name(ifname, vrf->vrf_id);
-#endif /* SUNOS_5 */
ifp->configured = true;
nb_running_set_entry(args->dnode, ifp);
diff --git a/lib/netns_other.c b/lib/netns_other.c
index 740d2b621..9cf7f1f33 100644
--- a/lib/netns_other.c
+++ b/lib/netns_other.c
@@ -18,8 +18,8 @@
*/
-#if !defined(GNU_LINUX) && (defined(SUNOS_5) || defined(OPEN_BSD))
-/* SUNOS_5 or OPEN_BSD */
+#if !defined(GNU_LINUX) && defined(OPEN_BSD)
+/* OPEN_BSD */
#include <zebra.h>
#include "ns.h"
diff --git a/lib/prefix.h b/lib/prefix.h
index 2a33d532c..471978ed2 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -22,15 +22,11 @@
#ifndef _ZEBRA_PREFIX_H
#define _ZEBRA_PREFIX_H
-#ifdef SUNOS_5
-#include <sys/ethernet.h>
-#else
#ifdef GNU_LINUX
#include <net/ethernet.h>
#else
#include <netinet/if_ether.h>
#endif
-#endif
#include "sockunion.h"
#include "ipaddr.h"
#include "compiler.h"
@@ -411,12 +407,7 @@ static inline void ipv4_addr_copy(struct in_addr *dst,
/* glibc defines s6_addr32 to __in6_u.__u6_addr32 if __USE_{MISC || GNU} */
#ifndef s6_addr32
-#if defined(SUNOS_5)
-/* Some SunOS define s6_addr32 only to kernel */
-#define s6_addr32 _S6_un._S6_u32
-#else
#define s6_addr32 __u6_addr.__u6_addr32
-#endif /* SUNOS_5 */
#endif /*s6_addr32*/
/* Prototypes. */
diff --git a/lib/privs.c b/lib/privs.c
index dc43b7279..1bb5d059c 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -37,12 +37,12 @@ DEFINE_MTYPE_STATIC(LIB, PRIVS, "Privilege information")
#ifdef HAVE_CAPABILITIES
#ifdef HAVE_LCAPS
static const bool privs_per_process; /* = false */
-#elif defined(HAVE_SOLARIS_CAPABILITIES)
-static const bool privs_per_process = true;
-#endif
#else
static const bool privs_per_process = true;
-#endif /* HAVE_CAPABILITIES */
+#endif /* HAVE_LCAPS */
+#else /* HAVE_CAPABILITIES */
+static const bool privs_per_process = true;
+#endif
#ifdef HAVE_CAPABILITIES
@@ -67,11 +67,7 @@ typedef cap_value_t pvalue_t;
typedef struct _pset pset_t;
typedef cap_t pstorage_t;
-#elif defined(HAVE_SOLARIS_CAPABILITIES)
-typedef priv_t pvalue_t;
-typedef priv_set_t pset_t;
-typedef priv_set_t *pstorage_t;
-#else /* neither LCAPS nor SOLARIS_CAPABILITIES */
+#else /* no LCAPS */
#error "HAVE_CAPABILITIES defined, but neither LCAPS nor Solaris Capabilties!"
#endif /* HAVE_LCAPS */
#endif /* HAVE_CAPABILITIES */
@@ -163,67 +159,7 @@ static struct {
{
1, (pvalue_t[]){CAP_FOWNER},
},
-#elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */
- /* Quagga -> Solaris privilege mappings */
- [ZCAP_SETID] =
- {
- 1, (pvalue_t[]){PRIV_PROC_SETID},
- },
- [ZCAP_BIND] =
- {
- 1, (pvalue_t[]){PRIV_NET_PRIVADDR},
- },
-/* IP_CONFIG is a subset of NET_CONFIG and is allowed in zones */
-#ifdef PRIV_SYS_IP_CONFIG
- [ZCAP_NET_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_IP_CONFIG},
- },
-#else
- [ZCAP_NET_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_NET_CONFIG},
- },
-#endif
- [ZCAP_NET_RAW] =
- {
- 2, (pvalue_t[]){PRIV_NET_RAWACCESS,
- PRIV_NET_ICMPACCESS},
- },
- [ZCAP_CHROOT] =
- {
- 1, (pvalue_t[]){PRIV_PROC_CHROOT},
- },
- [ZCAP_NICE] =
- {
- 1, (pvalue_t[]){PRIV_PROC_PRIOCNTL},
- },
- [ZCAP_PTRACE] =
- {
- 1, (pvalue_t[]){PRIV_PROC_SESSION},
- },
- [ZCAP_DAC_OVERRIDE] =
- {
- 5, (pvalue_t[]){PRIV_FILE_DAC_EXECUTE,
- PRIV_FILE_DAC_READ,
- PRIV_FILE_DAC_SEARCH,
- PRIV_FILE_DAC_WRITE,
- PRIV_FILE_DAC_SEARCH},
- },
- [ZCAP_READ_SEARCH] =
- {
- 2, (pvalue_t[]){PRIV_FILE_DAC_SEARCH,
- PRIV_FILE_DAC_READ},
- },
- [ZCAP_SYS_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_ADMIN},
- },
- [ZCAP_FOWNER] =
- {
- 1, (pvalue_t[]){PRIV_FILE_OWNER},
- },
-#endif /* HAVE_SOLARIS_CAPABILITIES */
+#endif /* HAVE_LCAPS */
};
#ifdef HAVE_LCAPS
@@ -432,225 +368,8 @@ static void zprivs_caps_terminate(void)
cap_free(zprivs_state.caps);
}
-#elif defined(HAVE_SOLARIS_CAPABILITIES) /* !HAVE_LCAPS */
-
-/* Solaris specific capability/privilege methods
- *
- * Resources:
- * - the 'privileges' man page
- * - http://cvs.opensolaris.org
- * -
- * http://blogs.sun.com/roller/page/gbrunett?entry=privilege_enabling_set_id_programs1
- */
-
-static pset_t *zprivs_caps_minimal()
-{
- pset_t *minimal;
-
- if ((minimal = priv_str_to_set("basic", ",", NULL)) == NULL) {
- fprintf(stderr, "%s: couldn't get basic set!\n", __func__);
- exit(1);
- }
-
- /* create a minimal privilege set from the basic set */
- (void)priv_delset(minimal, PRIV_PROC_EXEC);
- (void)priv_delset(minimal, PRIV_PROC_INFO);
- (void)priv_delset(minimal, PRIV_PROC_SESSION);
- (void)priv_delset(minimal, PRIV_FILE_LINK_ANY);
-
- return minimal;
-}
-
-/* convert zebras privileges to system capabilities */
-static pset_t *zcaps2sys(zebra_capabilities_t *zcaps, int num)
-{
- pset_t *syscaps;
- int i, j = 0;
-
- if ((syscaps = priv_allocset()) == NULL) {
- fprintf(stderr, "%s: could not allocate syscaps!\n", __func__);
- exit(1);
- }
-
- priv_emptyset(syscaps);
-
- for (i = 0; i < num; i++)
- for (j = 0; j < cap_map[zcaps[i]].num; j++)
- priv_addset(syscaps, cap_map[zcaps[i]].system_caps[j]);
-
- return syscaps;
-}
-
-/* callback exported to users to RAISE and LOWER effective privileges
- * from nothing to the given permitted set and back down
- */
-int zprivs_change_caps(zebra_privs_ops_t op)
-{
- pset_t *privset;
-
- /* should be no possibility of being called without valid caps */
- assert(zprivs_state.syscaps_p);
- if (!zprivs_state.syscaps_p) {
- fprintf(stderr, "%s: Eek, missing privileged caps!", __func__);
- exit(1);
- }
-
- assert(zprivs_state.caps);
- if (!zprivs_state.caps) {
- fprintf(stderr, "%s: Eek, missing caps!", __func__);
- exit(1);
- }
-
- /* to raise: copy original permitted as our working effective set
- * to lower: copy regular effective set stored in zprivs_state.caps
- */
- if (op == ZPRIVS_RAISE)
- privset = zprivs_state.syscaps_p;
- else if (op == ZPRIVS_LOWER)
- privset = zprivs_state.caps;
- else
- return -1;
-
- if (setppriv(PRIV_SET, PRIV_EFFECTIVE, privset) != 0)
- return -1;
-
- return 0;
-}
-
-/* Retrieve current privilege state, is it RAISED or LOWERED? */
-zebra_privs_current_t zprivs_state_caps(void)
-{
- zebra_privs_current_t result;
- pset_t *effective;
-
- if ((effective = priv_allocset()) == NULL) {
- fprintf(stderr, "%s: failed to get priv_allocset! %s\n",
- __func__, safe_strerror(errno));
- return ZPRIVS_UNKNOWN;
- }
-
- if (getppriv(PRIV_EFFECTIVE, effective)) {
- fprintf(stderr, "%s: failed to get state! %s\n", __func__,
- safe_strerror(errno));
- result = ZPRIVS_UNKNOWN;
- } else {
- if (priv_isequalset(effective, zprivs_state.syscaps_p))
- result = ZPRIVS_RAISED;
- else if (priv_isequalset(effective, zprivs_state.caps))
- result = ZPRIVS_LOWERED;
- else
- result = ZPRIVS_UNKNOWN;
- }
-
- priv_freeset(effective);
- return result;
-}
-
-static void zprivs_caps_init(struct zebra_privs_t *zprivs)
-{
- pset_t *basic;
- pset_t *minimal;
-
- /* the specified sets */
- zprivs_state.syscaps_p = zcaps2sys(zprivs->caps_p, zprivs->cap_num_p);
- zprivs_state.syscaps_i = zcaps2sys(zprivs->caps_i, zprivs->cap_num_i);
-
- /* nonsensical to have gotten here but not have capabilities */
- if (!zprivs_state.syscaps_p) {
- fprintf(stderr,
- "%s: capabilities enabled, but no valid capabilities supplied\n",
- __func__);
- }
-
- /* We retain the basic set in our permitted set, as Linux has no
- * equivalent. The basic set on Linux hence is implicit, always
- * there.
- */
- if ((basic = priv_str_to_set("basic", ",", NULL)) == NULL) {
- fprintf(stderr, "%s: couldn't get basic set!\n", __func__);
- exit(1);
- }
-
- /* Add the basic set to the permitted set */
- priv_union(basic, zprivs_state.syscaps_p);
- priv_freeset(basic);
-
- /* Hey kernel, we know about privileges!
- * this isn't strictly required, use of setppriv should have same effect
- */
- if (setpflags(PRIV_AWARE, 1)) {
- fprintf(stderr, "%s: error setting PRIV_AWARE!, %s\n", __func__,
- safe_strerror(errno));
- exit(1);
- }
-
- /* need either valid or empty sets for both p and i.. */
- assert(zprivs_state.syscaps_i && zprivs_state.syscaps_p);
-
- /* we have caps, we have no need to ever change back the original user
- * change real, effective and saved to the specified user.
- */
- /* only change uid if we don't have the correct one */
- if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) {
- if (setreuid(zprivs_state.zuid, zprivs_state.zuid)) {
- fprintf(stderr, "%s: could not setreuid, %s\n",
- __func__, safe_strerror(errno));
- exit(1);
- }
- }
-
- /* set the permitted set */
- if (setppriv(PRIV_SET, PRIV_PERMITTED, zprivs_state.syscaps_p)) {
- fprintf(stderr, "%s: error setting permitted set!, %s\n",
- __func__, safe_strerror(errno));
- exit(1);
- }
-
- /* set the inheritable set */
- if (setppriv(PRIV_SET, PRIV_INHERITABLE, zprivs_state.syscaps_i)) {
- fprintf(stderr, "%s: error setting inheritable set!, %s\n",
- __func__, safe_strerror(errno));
- exit(1);
- }
-
- /* we need a minimal basic set for 'effective', potentially for
- * inheritable too */
- minimal = zprivs_caps_minimal();
-
- /* now set the effective set with a subset of basic privileges */
- if (setppriv(PRIV_SET, PRIV_EFFECTIVE, minimal)) {
- fprintf(stderr, "%s: error setting effective set!, %s\n",
- __func__, safe_strerror(errno));
- exit(1);
- }
-
- /* we'll use the minimal set as our working-storage privset */
- zprivs_state.caps = minimal;
-
- /* set methods for the caller to use */
- zprivs->change = zprivs_change_caps;
- zprivs->current_state = zprivs_state_caps;
-}
-
-static void zprivs_caps_terminate(void)
-{
- assert(zprivs_state.caps);
-
- /* clear all capabilities by using working-storage privset */
- setppriv(PRIV_SET, PRIV_EFFECTIVE, zprivs_state.caps);
- setppriv(PRIV_SET, PRIV_PERMITTED, zprivs_state.caps);
- setppriv(PRIV_SET, PRIV_INHERITABLE, zprivs_state.caps);
-
- /* free up private state */
- if (zprivs_state.syscaps_p)
- priv_freeset(zprivs_state.syscaps_p);
- if (zprivs_state.syscaps_i)
- priv_freeset(zprivs_state.syscaps_i);
-
- priv_freeset(zprivs_state.caps);
-}
-#else /* !HAVE_LCAPS && ! HAVE_SOLARIS_CAPABILITIES */
-#error "Neither Solaris nor Linux capabilities, dazed and confused..."
+#else /* !HAVE_LCAPS */
+#error "no Linux capabilities, dazed and confused..."
#endif /* HAVE_LCAPS */
#endif /* HAVE_CAPABILITIES */
diff --git a/lib/sigevent.c b/lib/sigevent.c
index fcd85d0d4..04fcc814e 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -170,8 +170,6 @@ static void *program_counter(void *context)
#elif defined(__powerpc__)
# define REG_INDEX 32
#endif
-#elif defined(SUNOS_5) /* !GNU_LINUX */
-# define REG_INDEX REG_PC
#endif /* GNU_LINUX */
#ifdef REG_INDEX
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 21fddcd01..ed21b72df 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -20,10 +20,6 @@
#include <zebra.h>
-#ifdef SUNOS_5
-#include <ifaddrs.h>
-#endif
-
#include "log.h"
#include "sockopt.h"
#include "sockunion.h"
@@ -351,35 +347,6 @@ int setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr,
return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&m,
sizeof(m));
-#elif defined(SUNOS_5)
- char ifname[IF_NAMESIZE];
- struct ifaddrs *ifa, *ifap;
- struct in_addr ifaddr;
-
- if (if_indextoname(ifindex, ifname) == NULL)
- return -1;
-
- if (getifaddrs(&ifa) != 0)
- return -1;
-
- for (ifap = ifa; ifap != NULL; ifap = ifap->ifa_next) {
- struct sockaddr_in *sa;
-
- if (strcmp(ifap->ifa_name, ifname) != 0)
- continue;
- if (ifap->ifa_addr->sa_family != AF_INET)
- continue;
- sa = (struct sockaddr_in *)ifap->ifa_addr;
- memcpy(&ifaddr, &sa->sin_addr, sizeof(ifaddr));
- break;
- }
-
- freeifaddrs(ifa);
- if (!ifap) /* This means we did not find an IP */
- return -1;
-
- return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&ifaddr,
- sizeof(ifaddr));
#else
#error "Unsupported multicast API"
#endif
@@ -483,15 +450,9 @@ static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)
/* retrieval based on IP_RECVIF */
-#ifndef SUNOS_5
/* BSD systems use a sockaddr_dl as the control message payload. */
struct sockaddr_dl *sdl;
-#else
- /* SUNOS_5 uses an integer with the index. */
- ifindex_t *ifindex_p;
-#endif /* SUNOS_5 */
-#ifndef SUNOS_5
/* BSD */
sdl = (struct sockaddr_dl *)getsockopt_cmsg_data(msgh, IPPROTO_IP,
IP_RECVIF);
@@ -499,18 +460,6 @@ static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)
ifindex = sdl->sdl_index;
else
ifindex = 0;
-#else
- /*
- * Solaris. On Solaris 8, IP_RECVIF is defined, but the call to
- * enable it fails with errno=99, and the struct msghdr has
- * controllen 0.
- */
- ifindex_p = (uint_t *)getsockopt_cmsg_data(msgh, IPPROTO_IP, IP_RECVIF);
- if (ifindex_p != NULL)
- ifindex = *ifindex_p;
- else
- ifindex = 0;
-#endif /* SUNOS_5 */
#else
/*
diff --git a/lib/sockopt.h b/lib/sockopt.h
index 4081e6a45..545abe631 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -59,11 +59,7 @@ extern int setsockopt_ipv6_tclass(int, int);
#if defined(IP_RECVIF)
/* BSD/Solaris */
-#if defined(SUNOS_5)
-#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof(uint_t))
-#else
#define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof(struct sockaddr_dl))
-#endif /* SUNOS_5 */
#endif /* IP_RECVIF */
/* SOPT_SIZE_CMSG_IFINDEX_IPV4 - portable type */
diff --git a/lib/vty.c b/lib/vty.c
index 184c7604b..ac02d2b64 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -358,15 +358,6 @@ void vty_hello(struct vty *vty)
vty_out(vty, "MOTD file not found\n");
} else if (host.motd)
vty_out(vty, "%s", host.motd);
-
-#if CONFDATE > 20200901
- CPP_NOTICE("Please remove solaris code from system as it is deprecated");
-#endif
-#ifdef SUNOS_5
- zlog_warn("If you are using FRR on Solaris, the FRR developers would love to hear from you\n");
- zlog_warn("Please send email to dev@lists.frrouting.org about this message\n");
- zlog_warn("We are considering deprecating Solaris and want to find users of Solaris systems\n");
-#endif
}
/* Put out prompt and wait input from user. */
diff --git a/lib/zebra.h b/lib/zebra.h
index b2f0202c5..14d66d662 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -27,12 +27,6 @@
#include "compiler.h"
-#ifdef SUNOS_5
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;
-#endif /* SUNOS_5 */
-
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -76,11 +70,6 @@ typedef unsigned char uint8_t;
#include <stdbool.h>
/* machine dependent includes */
-#ifdef SUNOS_5
-#include <strings.h>
-#endif /* SUNOS_5 */
-
-/* machine dependent includes */
#ifdef HAVE_LINUX_VERSION_H
#include <linux/version.h>
#endif /* HAVE_LINUX_VERSION_H */
@@ -112,10 +101,6 @@ typedef unsigned char uint8_t;
#include <sys/prctl.h>
#endif /* HAVE_LCAPS */
-#ifdef HAVE_SOLARIS_CAPABILITIES
-#include <priv.h>
-#endif /* HAVE_SOLARIS_CAPABILITIES */
-
/* network include group */
#include <sys/socket.h>
@@ -306,8 +291,7 @@ struct in_pktinfo {
#if defined(__NetBSD__) \
|| (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) \
|| (defined(__OpenBSD__) && (OpenBSD < 200311)) \
- || (defined(__APPLE__)) \
- || (defined(SUNOS_5) && defined(WORDS_BIGENDIAN))
+ || (defined(__APPLE__))
#define HAVE_IP_HDRINCL_BSD_ORDER
#endif