*: 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>
This commit is contained in:
Donald Sharp 2020-09-08 23:59:18 -04:00
parent 1f79037b72
commit cae8bc967c
51 changed files with 24 additions and 3514 deletions

View file

@ -135,7 +135,6 @@ include qpb/subdir.am
include fpm/subdir.am include fpm/subdir.am
include grpc/subdir.am include grpc/subdir.am
include tools/subdir.am include tools/subdir.am
include solaris/subdir.am
include bgpd/subdir.am include bgpd/subdir.am
include bgpd/rfp-example/librfp/subdir.am include bgpd/rfp-example/librfp/subdir.am

View file

@ -33,12 +33,8 @@
/* probably ought to have a field-specific define in config.h */ /* probably ought to have a field-specific define in config.h */
#ifndef s6_addr32 /* for solaris/bsd */ #ifndef s6_addr32 /* for solaris/bsd */
#ifdef SOLARIS_IPV6
# define s6_addr32 _S6_un._S6_u32
#else
# define s6_addr32 __u6_addr.__u6_addr32 # define s6_addr32 __u6_addr.__u6_addr32
#endif #endif
#endif
#define RFAPI_V4_ADDR 0x04 #define RFAPI_V4_ADDR 0x04
#define RFAPI_V6_ADDR 0x06 #define RFAPI_V6_ADDR 0x06

View file

@ -1124,17 +1124,7 @@ is_linux=false
AC_MSG_CHECKING([which operating system interface to use]) AC_MSG_CHECKING([which operating system interface to use])
case "$host_os" in case "$host_os" in
sunos* | solaris2*) sunos* | solaris2*)
AC_MSG_RESULT([Solaris]) AC_MSG_FAILURE([Solaris support has been removed please see versions prior to 7.5])
AC_DEFINE([SUNOS_5], [1], [SunOS 5])
AC_DEFINE([SOLARIS_IPV6], [1], Solaris IPv6)
AC_DEFINE([_POSIX_C_SOURCE], [200809L], [enable POSIX.1-2008 and XPG7/SUSv4])
AC_CHECK_LIB([socket], [main])
AC_CHECK_LIB([nsl], [main])
AC_CHECK_LIB([umem], [main])
SOLARIS="solaris"
AC_MSG_WARN([--Solaris support is being considered for deprecation, please let us know if you are still using this--])
;; ;;
linux*) linux*)
AC_MSG_RESULT([Linux]) AC_MSG_RESULT([Linux])
@ -1167,7 +1157,6 @@ case "$host_os" in
AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding]) AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding])
;; ;;
esac esac
AM_CONDITIONAL([SOLARIS], [test "$SOLARIS" = "solaris"])
AM_CONDITIONAL([LINUX], [${is_linux}]) AM_CONDITIONAL([LINUX], [${is_linux}])
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
@ -1391,10 +1380,6 @@ case "$host_os" in
AC_MSG_RESULT([pfpacket]) AC_MSG_RESULT([pfpacket])
ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET" ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
;; ;;
solaris* | sunos*)
AC_MSG_RESULT([DLPI])
ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
;;
*) *)
if test "$ac_cv_header_net_bpf_h" = "no"; then if test "$ac_cv_header_net_bpf_h" = "no"; then
if test "$ac_cv_header_sys_dlpi_h" = "no"; then if test "$ac_cv_header_sys_dlpi_h" = "no"; then
@ -1512,7 +1497,6 @@ if test "$ac_cv_have_decl_TCP_MD5SIG" = "no"; then
AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)]) AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
fi fi
AC_SUBST([SOLARIS])
AC_CHECK_LIB([crypt], [crypt], [], AC_CHECK_LIB([crypt], [crypt], [],
[AC_CHECK_LIB([crypto], [DES_crypt])]) [AC_CHECK_LIB([crypto], [DES_crypt])])
AC_CHECK_LIB([resolv], [res_init]) AC_CHECK_LIB([resolv], [res_init])
@ -2143,17 +2127,6 @@ if test "$enable_capabilities" != "no"; then
LIBCAP="-lcap" LIBCAP="-lcap"
frr_ac_lcaps="yes"] frr_ac_lcaps="yes"]
) )
else
AC_CHECK_HEADERS([priv.h],
[AC_MSG_CHECKING([Solaris style privileges are available])
AC_TRY_COMPILE([#include <priv.h>], [getpflags(PRIV_AWARE);],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SOLARIS_CAPABILITIES], [1], [getpflags])
frr_ac_scaps="yes"],
AC_MSG_RESULT(no)
)
]
)
fi fi
if test "$frr_ac_scaps" = "yes" \ if test "$frr_ac_scaps" = "yes" \
-o "$frr_ac_lcaps" = "yes"; then -o "$frr_ac_lcaps" = "yes"; then
@ -2219,7 +2192,7 @@ dnl check for malloc mallinfo struct and call
dnl this must try and link using LIBS, in dnl this must try and link using LIBS, in
dnl order to check no alternative allocator dnl order to check no alternative allocator
dnl has been specified, which might not provide dnl has been specified, which might not provide
dnl mallinfo, e.g. such as Umem on Solaris. dnl mallinfo
dnl ----------------------------------------- dnl -----------------------------------------
AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES]) AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES])
@ -2413,7 +2386,6 @@ AC_CONFIG_FILES([
config.version config.version
changelog-auto changelog-auto
redhat/frr.spec redhat/frr.spec
solaris/Makefile
alpine/APKBUILD alpine/APKBUILD
snapcraft/snapcraft.yaml snapcraft/snapcraft.yaml
lib/version.h lib/version.h

View file

@ -802,44 +802,6 @@ void if_dump_all(void)
if_dump(ifp); 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 #if 0
/* For debug purpose. */ /* For debug purpose. */
DEFUN (show_address, DEFUN (show_address,
@ -1554,11 +1516,7 @@ static int lib_interface_create(struct nb_cb_create_args *args)
case NB_EV_APPLY: case NB_EV_APPLY:
vrf = vrf_lookup_by_name(vrfname); vrf = vrf_lookup_by_name(vrfname);
assert(vrf); assert(vrf);
#ifdef SUNOS_5
ifp = if_sunwzebra_get(ifname, vrf->vrf_id);
#else
ifp = if_get_by_name(ifname, vrf->vrf_id); ifp = if_get_by_name(ifname, vrf->vrf_id);
#endif /* SUNOS_5 */
ifp->configured = true; ifp->configured = true;
nb_running_set_entry(args->dnode, ifp); nb_running_set_entry(args->dnode, ifp);

View file

@ -18,8 +18,8 @@
*/ */
#if !defined(GNU_LINUX) && (defined(SUNOS_5) || defined(OPEN_BSD)) #if !defined(GNU_LINUX) && defined(OPEN_BSD)
/* SUNOS_5 or OPEN_BSD */ /* OPEN_BSD */
#include <zebra.h> #include <zebra.h>
#include "ns.h" #include "ns.h"

View file

@ -22,15 +22,11 @@
#ifndef _ZEBRA_PREFIX_H #ifndef _ZEBRA_PREFIX_H
#define _ZEBRA_PREFIX_H #define _ZEBRA_PREFIX_H
#ifdef SUNOS_5
#include <sys/ethernet.h>
#else
#ifdef GNU_LINUX #ifdef GNU_LINUX
#include <net/ethernet.h> #include <net/ethernet.h>
#else #else
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#endif #endif
#endif
#include "sockunion.h" #include "sockunion.h"
#include "ipaddr.h" #include "ipaddr.h"
#include "compiler.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} */ /* glibc defines s6_addr32 to __in6_u.__u6_addr32 if __USE_{MISC || GNU} */
#ifndef s6_addr32 #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 #define s6_addr32 __u6_addr.__u6_addr32
#endif /* SUNOS_5 */
#endif /*s6_addr32*/ #endif /*s6_addr32*/
/* Prototypes. */ /* Prototypes. */

View file

@ -37,12 +37,12 @@ DEFINE_MTYPE_STATIC(LIB, PRIVS, "Privilege information")
#ifdef HAVE_CAPABILITIES #ifdef HAVE_CAPABILITIES
#ifdef HAVE_LCAPS #ifdef HAVE_LCAPS
static const bool privs_per_process; /* = false */ static const bool privs_per_process; /* = false */
#elif defined(HAVE_SOLARIS_CAPABILITIES)
static const bool privs_per_process = true;
#endif
#else #else
static const bool privs_per_process = true; 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 #ifdef HAVE_CAPABILITIES
@ -67,11 +67,7 @@ typedef cap_value_t pvalue_t;
typedef struct _pset pset_t; typedef struct _pset pset_t;
typedef cap_t pstorage_t; typedef cap_t pstorage_t;
#elif defined(HAVE_SOLARIS_CAPABILITIES) #else /* no LCAPS */
typedef priv_t pvalue_t;
typedef priv_set_t pset_t;
typedef priv_set_t *pstorage_t;
#else /* neither LCAPS nor SOLARIS_CAPABILITIES */
#error "HAVE_CAPABILITIES defined, but neither LCAPS nor Solaris Capabilties!" #error "HAVE_CAPABILITIES defined, but neither LCAPS nor Solaris Capabilties!"
#endif /* HAVE_LCAPS */ #endif /* HAVE_LCAPS */
#endif /* HAVE_CAPABILITIES */ #endif /* HAVE_CAPABILITIES */
@ -163,67 +159,7 @@ static struct {
{ {
1, (pvalue_t[]){CAP_FOWNER}, 1, (pvalue_t[]){CAP_FOWNER},
}, },
#elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */ #endif /* 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 */
}; };
#ifdef HAVE_LCAPS #ifdef HAVE_LCAPS
@ -432,225 +368,8 @@ static void zprivs_caps_terminate(void)
cap_free(zprivs_state.caps); cap_free(zprivs_state.caps);
} }
#elif defined(HAVE_SOLARIS_CAPABILITIES) /* !HAVE_LCAPS */ #else /* !HAVE_LCAPS */
#error "no Linux capabilities, dazed and confused..."
/* 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..."
#endif /* HAVE_LCAPS */ #endif /* HAVE_LCAPS */
#endif /* HAVE_CAPABILITIES */ #endif /* HAVE_CAPABILITIES */

View file

@ -170,8 +170,6 @@ static void *program_counter(void *context)
#elif defined(__powerpc__) #elif defined(__powerpc__)
# define REG_INDEX 32 # define REG_INDEX 32
#endif #endif
#elif defined(SUNOS_5) /* !GNU_LINUX */
# define REG_INDEX REG_PC
#endif /* GNU_LINUX */ #endif /* GNU_LINUX */
#ifdef REG_INDEX #ifdef REG_INDEX

View file

@ -20,10 +20,6 @@
#include <zebra.h> #include <zebra.h>
#ifdef SUNOS_5
#include <ifaddrs.h>
#endif
#include "log.h" #include "log.h"
#include "sockopt.h" #include "sockopt.h"
#include "sockunion.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, return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&m,
sizeof(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 #else
#error "Unsupported multicast API" #error "Unsupported multicast API"
#endif #endif
@ -483,15 +450,9 @@ static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)
/* retrieval based on IP_RECVIF */ /* retrieval based on IP_RECVIF */
#ifndef SUNOS_5
/* BSD systems use a sockaddr_dl as the control message payload. */ /* BSD systems use a sockaddr_dl as the control message payload. */
struct sockaddr_dl *sdl; struct sockaddr_dl *sdl;
#else
/* SUNOS_5 uses an integer with the index. */
ifindex_t *ifindex_p;
#endif /* SUNOS_5 */
#ifndef SUNOS_5
/* BSD */ /* BSD */
sdl = (struct sockaddr_dl *)getsockopt_cmsg_data(msgh, IPPROTO_IP, sdl = (struct sockaddr_dl *)getsockopt_cmsg_data(msgh, IPPROTO_IP,
IP_RECVIF); IP_RECVIF);
@ -499,18 +460,6 @@ static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)
ifindex = sdl->sdl_index; ifindex = sdl->sdl_index;
else else
ifindex = 0; 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 #else
/* /*

View file

@ -59,11 +59,7 @@ extern int setsockopt_ipv6_tclass(int, int);
#if defined(IP_RECVIF) #if defined(IP_RECVIF)
/* BSD/Solaris */ /* 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)) #define SOPT_SIZE_CMSG_RECVIF_IPV4() (sizeof(struct sockaddr_dl))
#endif /* SUNOS_5 */
#endif /* IP_RECVIF */ #endif /* IP_RECVIF */
/* SOPT_SIZE_CMSG_IFINDEX_IPV4 - portable type */ /* SOPT_SIZE_CMSG_IFINDEX_IPV4 - portable type */

View file

@ -358,15 +358,6 @@ void vty_hello(struct vty *vty)
vty_out(vty, "MOTD file not found\n"); vty_out(vty, "MOTD file not found\n");
} else if (host.motd) } else if (host.motd)
vty_out(vty, "%s", 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. */ /* Put out prompt and wait input from user. */

View file

@ -27,12 +27,6 @@
#include "compiler.h" #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 <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -75,11 +69,6 @@ typedef unsigned char uint8_t;
#include <inttypes.h> #include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>
/* machine dependent includes */
#ifdef SUNOS_5
#include <strings.h>
#endif /* SUNOS_5 */
/* machine dependent includes */ /* machine dependent includes */
#ifdef HAVE_LINUX_VERSION_H #ifdef HAVE_LINUX_VERSION_H
#include <linux/version.h> #include <linux/version.h>
@ -112,10 +101,6 @@ typedef unsigned char uint8_t;
#include <sys/prctl.h> #include <sys/prctl.h>
#endif /* HAVE_LCAPS */ #endif /* HAVE_LCAPS */
#ifdef HAVE_SOLARIS_CAPABILITIES
#include <priv.h>
#endif /* HAVE_SOLARIS_CAPABILITIES */
/* network include group */ /* network include group */
#include <sys/socket.h> #include <sys/socket.h>
@ -306,8 +291,7 @@ struct in_pktinfo {
#if defined(__NetBSD__) \ #if defined(__NetBSD__) \
|| (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) \ || (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) \
|| (defined(__OpenBSD__) && (OpenBSD < 200311)) \ || (defined(__OpenBSD__) && (OpenBSD < 200311)) \
|| (defined(__APPLE__)) \ || (defined(__APPLE__))
|| (defined(SUNOS_5) && defined(WORDS_BIGENDIAN))
#define HAVE_IP_HDRINCL_BSD_ORDER #define HAVE_IP_HDRINCL_BSD_ORDER
#endif #endif

19
solaris/.gitignore vendored
View file

@ -1,19 +0,0 @@
Makefile
!Makefile.in
?.manifest
*.xml
pkginfo.*.full
pkginfo.tmpl
prototype.daemons
prototype.dev
prototype.doc
prototype.libs
prototype.smf
depend.daemons
depend.dev
depend.doc
depend.libs
depend.smf
frr.init
*.pkg
*.pkg.gz

View file

@ -1,155 +0,0 @@
# Solaris packages automake file
# XXX This file uses GNU make extensions.
.PHONY: packages all all-files
all: all-files
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
includedir = @includedir@
infodir = @infodir@
mandir = @mandir@
frr_statedir = @frr_statedir@
builddir = @builddir@
srcdir = @srcdir@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
enable_user = @enable_user@
enable_group = @enable_group@
enable_vty_group = @enable_vty_group@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
CONFDATE = @CONFDATE@
host_cpu = @host_cpu@
host_os = @host_os@
SED = @SED@
MAKE = @MAKE@
# the names of the various subpackages, and some convenient
# derived variables.
pkg_names = daemons dev doc libs smf
pkg_frr_daemons = zebra bgpd ospfd ospf6d ripd ripngd
pkg_name_rev = $(PACKAGE_VERSION)-$(CONFDATE)-$(host_os)-$(host_cpu)
pkg_depends = $(pkg_names:%=depend.%)
pkg_packages = $(pkg_names:%=@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg)
pkg_pkginfos = $(pkg_names:%=pkginfo.%.full)
pkg_prototypes = $(pkg_names:%=prototype.%)
pkg_manifests = frr.xml
# pkgmk variable substitutions wont grok ${variable} in prototype
# file, so we cant let autoconf generate the file sadly
# wish automake would just provide a template for this
edit = $(SED) \
-e 's,@prefix\@,$(prefix),g' \
-e 's,@exec_prefix,$(exec_prefix),g' \
-e 's,@bindir\@,$(bindir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@libexecdir\@,$(libexecdir),g' \
-e 's,@datadir\@,$(datadir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
-e 's,@sharedstatedir\@,$(sharedstatedir),g' \
-e 's,@localstatedir\@,$(localstatedir),g' \
-e 's,@libdir\@,$(libdir),g' \
-e 's,@includedir\@,$(includedir),g' \
-e 's,@infodir\@,$(infodir),g' \
-e 's,@mandir\@,$(mandir),g' \
-e 's,@enable_user\@,$(enable_user),g' \
-e 's,@enable_group\@,$(enable_group),g' \
-e 's,@enable_vty_group\@,$(enable_vty_group),g' \
-e 's,@frr_statedir\@,$(frr_statedir),g' \
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
-e 's,[@]PACKAGE_TARNAME[@],$(PACKAGE_TARNAME),g' \
-e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
-e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
-e 's,[@]CONFDATE[@],$(CONFDATE),g' \
-e 's,[@]host_cpu[@],$(host_cpu),g' \
-e 's,[@]host_os[@],$(host_os),g'
# common options for pkgmk
pkg_make_vars = exec_prefix=$(exec_prefix) prefix=$(prefix) \
builddir=$(builddir) srcdir=$(srcdir) \
top_builddir=$(top_builddir) top_srcdir=$(top_srcdir) \
abs_builddir=$(abs_builddir) abs_srcdir=$(abs_srcdir) \
abs_top_builddir=$(abs_top_builddir) abs_top_srcdir=$(abs_top_srcdir)
# pkgmk: write the package to spool in build dir, to avoid root dependencies
pkg_make = pkgmk -o -d $(abs_builddir) \
-f $< DESTDIR="$(DESTDIR)/" $(pkg_make_vars)
# pkgtrans: write a pkg file stream, shame we cant pipe directly to it from
# pkgmk..
pkg_trans = pkgtrans -s $(abs_builddir) "$(abs_builddir)/$@"
# pkgmk can only cope with a single pkginfo, cant 'stack' various
# pkginfo template files and a package specific pkginfo file in the prototype
# Create the package specific template here, and create the full pkginfo
# by cating this and the common pkginfo.tmpl together.
pkginfo.tmpl: $(srcdir)/pkginfo.tmpl.in Makefile
rm -f $@
$(edit) $< > $@
pkginfo.%.tmpl: $(srcdir)/pkginfo.%.tmpl.in Makefile
rm -f $@
$(edit) $< > $@
pkginfo.%.full: pkginfo.%.tmpl pkginfo.tmpl Makefile
cat pkginfo.tmpl pkginfo.$*.tmpl > $@
# use 'edit' above to transform prototype.in to pkgmk acceptable prototype
prototype.%: $(srcdir)/prototype.%.in Makefile
rm -f $@
$(edit) $< > $@
# use edit to construct the SMF manifest files
%.xml: $(srcdir)/%.xml.in Makefile
rm -f $@
$(edit) $< > $@
# use edit to construct the depend files
depend.%: $(srcdir)/depend.%.in Makefile
rm -f $@
$(edit) $< > $@
# method file (bit like init script)
frr.init: $(srcdir)/frr.init.in Makefile
rm -f $@
$(edit) $< > $@
# construct the pkg
$(PACKAGE_TARNAME)-%-$(pkg_name_rev).pkg: prototype.% \
depend.% frr.init pkginfo.%.full
($(pkg_make) && \
$(pkg_trans) "FRR$*")
%.pkg.gz : %.pkg
(gzip -c $< > $@)
pkg-root-install:
(cd $(top_builddir) && \
$(MAKE) DESTDIR=$(abs_builddir)/frr-root install)
packages: $(pkg_packages)
all-files: $(pkg_pkginfos) pkginfo.tmpl $(pkg_prototypes) \
$(pkg_manifests) $(pkg_depends) frr.init

View file

@ -1,186 +0,0 @@
To build packages for Solaris 10:
Requirements:
-------------
- Development environment including gcc (eg as shipped with Solaris 10)
- The Package tools from Solaris 10 or Solaris Nevada/Express.
- i.manifest and r.manifest scripts as supplied with Solaris Express
in /usr/sadm/install/scripts/ or from OpenSolaris.org:
http://cvs.opensolaris.org/source/xref/usr/src/pkgdefs/common_files/i.manifest
http://cvs.opensolaris.org/source/xref/usr/src/pkgdefs/common_files/r.manifest
i.manifest must be at least version 1.5. Place these scripts in
this directory if you are using Solaris 10 GA (which does not ship with
these scripts), or in the solaris/ directory in the FRRouting source.
Package creation instructions:
------------------------------
1. Configure and build FRRouting (frr) in the top level build directory as per normal, eg:
./configure --prefix=/usr/local/frr \
--localstatedir=/var/run/frr \
--enable-gcc-rdynamic --enable-opaque-lsa --enable-ospf-te \
--enable-multipath=64 --enable-user=frr \
--enable-ospfclient=yes --enable-ospfapi=yes \
--enable-group=frr --enable-nssa --enable-opaque-lsa
You will need /usr/sfw/bin and /usr/ccs/bin in your path.
2. make install in the top-level build directory, it's a good idea to make
use of DESTDIR to install to an alternate root, eg:
gmake DESTDIR=/var/tmp/qroot install
3. In this directory (solaris/), run make packages, specifying DESTDIR if
appropriate, eg:
gmake DESTDIR=/var/tmp/qroot packages
This should result in 4 packages being created:
frr-libs-...-$ARCH.pkg - FRRlibs
frr-daemons-...-$ARCH.pkg - FRRdaemons
frr-doc-...-$ARCH.pkg - FRRdoc
frr-dev-...-$ARCH.pkg - FRRdev
frr-smf-...-$ARCH.pkg - FRRsmf
FRRlibs and FRRdaemons are needed for daemon runtime. FRRsmf
provides the required bits for Solaris 10+ SMF support.
Install and post-install configuration notes:
---------------------------------------------
- If you specified a user/group which does not exist per default on Solaris
(eg frr/frr) you *must* create these before installing these on a
system. The packages do *not* create the users.
- The configuration files are not created. You must create the configuration
file yourself, either with your complete desired configuration, or else if
you wish to use the telnet interface for further configuration you must
create them containing at least:
password whatever
The user which frr runs as must have write permissions on this file, no
other user should have read permissions, and you would also have to enable
the telnet interface (see below).
- SMF notes:
- FRRsmf installs a svc:/network/routing/frr service, with an
instance for each daemon
- The state of all instances of frr service can be inspected with:
svcs -l svc:/network/routing/frr
or typically just with a shortcut of 'frr':
svcs -l frr
- A specific instance of the frr service can be inspected by specifying
the daemon name as the instance, ie frr:<daemon>:
svcs -l svc:/network/routing/frr:zebra
svcs -l svc:/network/routing/frr:ospfd
<etc>
or typically just with the shortcut of 'frr:<daemon>' or even
<daemon>:
svcs -l frr:zebra
svcs -l ospfd
Eg:
# # svcs -l ripd
fmri svc:/network/routing/frr:ripd
name FRRouting: ripd, RIPv1/2 IPv4 routing protocol daemon.
enabled true
state online
next_state none
state_time Wed Jun 15 16:21:02 2005
logfile /var/svc/log/network-routing-frr:ripd.log
restarter svc:/system/svc/restarter:default
contract_id 93
dependency require_all/restart svc:/network/routing/frr:zebra (online)
dependency require_all/restart file://localhost//usr/local/frr/etc/ripd.conf (online)
dependency require_all/none svc:/system/filesystem/usr:default (online)
dependency require_all/none svc:/network/loopback (online)
- Configuration of startup options is by way of SMF properties in a
property group named 'frr'. The defaults should automatically be
inline with how you configured FRRouting in Step 1 above.
- By default the VTY interface is disabled. To change this, see below for
how to set the 'frr/vty_port' property as appropriate for
/each/ service. Also, the VTY is set to listen only to localhost by
default, you may change the 'frr/vty_addr' property as appropriate
for both of the 'frr' service and specific individual instances of
the 'frr' service (ie frr:zebra, frr:ospfd, etc..).
- Properties belonging to the 'frr' service are inherited by all
instances. Eg:
# svcprop -p frr svc:/network/routing/frr
frr/group astring root
frr/retain boolean false
frr/user astring root
frr/vty_addr astring 127.1
frr/vty_port integer 0
# svcprop -p frr svc:/network/routing/frr:ospfd
frr/retain_routes boolean false
frr/group astring root
frr/retain boolean false
frr/user astring root
frr/vty_addr astring 127.1
frr/vty_port integer 0
All instances will inherit these properties, unless the instance itself
overrides these defaults. This also implies one can modify properties of
the 'frr' service and have them apply to all daemons.
# svccfg -s svc:/network/routing/frr \
setprop frr/vty_addr = astring: ::1
# svcprop -p frr svc:/network/routing/frr
frr/group astring root
frr/retain boolean false
frr/user astring root
frr/vty_port integer 0
frr/vty_addr astring ::1
# # You *must* refresh instances to have the property change
# # take affect for the 'running snapshot' of service state.
# svcadm refresh frr:ospfd
# svcprop -p frr svc:/network/routing/frr:ospfd
frr/retain_routes boolean false
frr/group astring root
frr/retain boolean false
frr/user astring root
frr/vty_port integer 0
frr/vty_addr astring ::1
Other daemon-specific options/properties may be available, however they
are not yet honoured/used (eg ospfd/apiserver on svc:/network/ospf).
- As SMF is dependency aware, restarting network/zebra will restart all the
other daemons.
- To upgrade from one set of FRRouting packages to a newer release,
one must first pkgrm the installed packages. When one pkgrm's FRRsmf all
property configuration will be lost, and any customisations will have to
redone after installing the updated FRRsmf package.
- These packages are not supported by Sun Microsystems, report bugs via the
usual FRRouting channels, ie Issue Tracker. Improvements/contributions of course would be greatly appreciated.

View file

@ -1,8 +0,0 @@
P FRRlibs FRRouting common runtime libraries
@PACKAGE_VERSION@,REV=@CONFDATE@
P SUNWcsu Core Solaris, (Usr)
P SUNWcsr Core Solaris Libraries (Root)
P SUNWcnetr Core Solaris Network Infrastructure (Root)
I SUNWzebrar
I SUNWzebrau
I CSWzebra

View file

@ -1,2 +0,0 @@
P FRRlibs FRRouting common runtime libraries
@PACKAGE_VERSION@,REV=@CONFDATE@

View file

@ -1 +0,0 @@
P SUNWdoc Documentation Tools

View file

@ -1,5 +0,0 @@
P SUNWcslr Core Solaris Libraries (Root)
P SUNWcsl Core Solaris, (Shared Libs)
P SUNWlibmsr Math & Microtasking Libraries (Root)
R FRRdaemons FRRouting daemons
R FRRdev

View file

@ -1,8 +0,0 @@
P FRRaemons FRRouting daemons
@PACKAGE_VERSION@,REV=@CONFDATE@
P SUNWcsu Core Solaris, (Usr)
P SUNWcsr Core Solaris Libraries (Root)
P SUNWroute Network Routing daemons/commands (Usr)
I SUNWzebrar
I SUNWzebrau
I CSWzebra

View file

@ -1,276 +0,0 @@
#!/sbin/sh
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# This file is part of FRRouting.
#
# FRRouting is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# FRRouting is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FRRouting; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Starts/stops the given daemon
SMFINCLUDE=/lib/svc/share/smf_include.sh
ROUTEADMINCLUDE=/lib/svc/share/routing_include.sh
GLOBAL_OPTIONS="PAfiug"
DAEMON_PATH=@sbindir@
USER=@enable_user@
GROUP=@enable_group@
# handle upgrade of daemon-args SMF property to new routeadm properties
# used during upgrade too by routeadm.
# relevant to S10U4+ only.
handle_routeadm_upgrade () {
GLOBAL_OPTIONS="PAfiug"
daemon_args=`get_daemon_args $SMF_FMRI`
if [ -n "$daemon_args" ]; then
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "P" vty_port 0
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "A" vty_address
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "f" config_file
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "i" pid_file
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "u" user
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"$GLOBAL_OPTIONS" "g" group
case "$1" in
zebra)
set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
"${GLOBAL_OPTIONS}b" "b" batch true false
;;
ripd|ripngd)
set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
"${GLOBAL_OPTIONS}r" "r" retain true false
;;
bgpd)
set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
"${GLOBAL_OPTIONS}rnp" "r" retain true false
set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
"${GLOBAL_OPTIONS}rnp" "n" no_kernel true false
set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
"${GLOBAL_OPTIONS}rnp" "p" bgp_port
esac
clear_daemon_args $SMF_FMRI
fi
}
upgrade_config () {
DAEMON=$1
# handle upgrade of SUNWzebra to FRRouting
if [ -d "/etc/frr" -a ! -f "/etc/frr/${DAEMON}.conf" ] ; then
if [ -f "/etc/sfw/zebra/${DAEMON}.conf" ] ; then
cp "/etc/sfw/zebra/${DAEMON}.conf" \
"/etc/frr/${DAEMON}.conf.upgrade" \
|| exit $SMF_EXIT_ERR_FATAL
chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.upgrade" \
|| exit $SMF_EXIT_ERR_FATAL
chmod 0600 "/etc/frr/${DAEMON}.conf.upgrade" \
|| exit $SMF_EXIT_ERR_FATAL
mv "/etc/frr/${DAEMON}.conf.upgrade" "/etc/frr/${DAEMON}.conf" \
|| exit $SMF_EXIT_ERR_FATAL
fi
fi
if [ ! -f "/etc/frr/${DAEMON}.conf" ] ; then
touch "/etc/frr/${DAEMON}.conf.new" \
|| exit $SMF_EXIT_ERR_FATAL
chown "${USER}:${GROUP}" "/etc/frr/${DAEMON}.conf.new" \
|| exit $SMF_EXIT_ERR_FATAL
chmod 0600 "/etc/frr/${DAEMON}.conf.new" \
|| exit $SMF_EXIT_ERR_FATAL
mv "/etc/frr/${DAEMON}.conf.new" "/etc/frr/${DAEMON}.conf" \
|| exit $SMF_EXIT_ERR_FATAL
fi
}
# Relevant to S10+
frr_is_globalzone () {
if [ "${FRR_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \
-o `/sbin/zonename -t` = "exclusive" ]; then
return 0
else
return 1
fi
}
routeadm_daemon_args () {
# globals
args="`get_daemon_option_from_property $SMF_FMRI config_file f`"
args="${args} `get_daemon_option_from_property $SMF_FMRI vty_port P`"
args="${args} `get_daemon_option_from_property $SMF_FMRI vty_address A`"
args="${args} `get_daemon_option_from_property $SMF_FMRI pid_file i`"
# user and group we need for config file upgrade..
SMF_USER=`get_routeadm_property $SMF_FMRI user`
SMF_GROUP=`get_routeadm_property()$SMF_FMRI group`
if [ "${SMF_USER}" ] ; then
USER="${SMF_USER}"
args="${args} -u ${SMF_USER}"
fi
if [ "${SMF_GROUP}" ] ; then
GROUP="${SMF_GROUP}"
args="${args} -g ${SMF_GROUP}"
fi
case $1 in
zebra)
args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI batch -b true`"
;;
ripd|ripngd)
args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`"
;;
bgpd)
args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`"
args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI no_kernel -n true`"
args="${args} `get_daemon_option_from_property $SMF_FMRI bgp_port p 179`"
;;
esac
echo ${args}
}
# Include smf functions, if available. If not, define smf_present to indicate
# there is no SMF. Should allow this script to work pre-S10.
if [ -f "$SMFINCLUDE" ] ; then
. "$SMFINCLUDE";
# source the SMF-routeadm include if present..
if [ -f "$ROUTEADMINCLUDE" ] ; then
. "$ROUTEADMINCLUDE"
fi
else
# pre-SMF system, fake up any functions and exit codes
# which SMFINCLUDE usually provides.
smf_present () {
return 1
}
SMF_EXIT_OK=0;
SMF_EXIT_ERR_CONFIG=96;
SMF_EXIT_ERR_FATAL=95;
fi
# if there's no SMF, set some default DAEMON_ARGS
smf_present || DAEMON_ARGS=""
usage () {
if smf_present ; then
echo "Usage: $0 <daemon>";
else
echo "Usage: $0 <stop|start> <daemon> <daemon arguments>";
fi
echo "The --pid_file argument is implied";
echo "This help message: $0 <help|usage>";
}
# parse arguments, different according to SMF or not.
case $1 in
'help' | 'usage')
usage
exit $SMF_EXIT_OK
;;
esac
if smf_present ; then
FRR_METHOD="start"
else
FRR_METHOD="$1"
shift;
fi
DAEMON="$1"
# daemon path must be given
if [ -z "$DAEMON_PATH/$DAEMON" ]; then
usage
exit $SMF_EXIT_ERR_FATAL
fi
# only bgpd is suitable for running in a non-global zone, at this
# time.
case "${DAEMON}" in
bgpd)
;;
zebra | ospfd | ospf6d | ripd | ripngd )
frr_is_globalzone || exit $SMF_EXIT_OK
;;
*)
usage
exit $SMF_EXIT_ERR_CONFIG;
;;
esac
# Older FRRouting SMF packages pass daemon args on the commandline
# Newer SMF routeadm model uses properties for each argument
# so we must handle that.
if [ smf_present -a -f "$ROUTEADMINCLUDE" ]; then
handle_routeadm_upgrade $DAEMON;
DAEMON_ARGS=`routeadm_daemon_args`;
else
if [ $# -gt 0 ] ; then
shift
DAEMON_ARGS="$@"
fi
fi
upgrade_config "$DAEMON"
if [ ! -f "@sysconfdir@/${DAEMON}.conf" ] ; then
echo "Could not find config file, @sysconfdir@/${DAEMON}.conf"
exit $SMF_EXIT_ERR_CONFIG
fi
# we need @frr_statedir@ to exist, it probably is on tmpfs.
if [ ! -d @frr_statedir@ ] ; then
mkdir -p @frr_statedir@
chown @enable_user@:@enable_group@ @frr_statedir@
chmod 751 @frr_statedir@
fi
PIDFILE="@frr_statedir@/${DAEMON}.pid"
start () {
if [ ! -x "$DAEMON_PATH/$DAEMON" ] ; then
echo "Error, could not find daemon, $DAEMON_PATH/$DAEMON"
exit $SMF_EXIT_ERR_FATAL
fi
eval exec $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} &
}
stop_by_pidfile () {
if [ -f "${PIDFILE}" ]; then
/usr/bin/kill -TERM `/usr/bin/cat "${PIDFILE}"`
fi
}
case "$FRR_METHOD" in
'start')
start
;;
'stop')
stop_by_pidfile
;;
*)
usage
exit $SMF_EXIT_ERR_FATAL
;;
esac
exit $SMF_EXIT_OK;

View file

@ -1,828 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
This file is part of FRRouting (FRR)
FRRouting is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or
(at your option) anylater version.
FRRouting is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with FRRouting; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Copyright 2007 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Copyright 2015 Joyent, Inc.
ident "@(#)frr.xml 1.0 19/01/17 SMI"
-->
<service_bundle type='manifest' name='SUNWfrr-daemons:frr'>
<service
name='network/routing/zebra'
type='service'
version='1'>
<single_instance />
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency name='net'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/initial' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr zebra'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60'>
</exec_method>
<!-- if we define these properties at the service level, each
instance inherits them, and it can override with
desired values.
-->
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/zebra' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- zebra should not contribute to ipv4/ipv6 routing state -->
<propval name='protocol' type='astring' value='zebra' />
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<stability value='Evolving' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to FRRouting daemons
Property names are equivalent to the long
option name, consult FRRouting documentation -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
<!-- Options specific to zebra -->
<propval name='batch' type='boolean' value='false' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
FRRouting: zebra, RIB, kernel intermediary and misc daemon
</loctext>
</common_name>
<documentation>
<manpage title='zebra' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
<service
name='network/routing/rip'
type='service'
version='1'>
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency
name='ipv4-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv4-forwarding' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<!-- ensure that restart of zebra is propogated to daemon -->
<dependency
name='zebra'
grouping='require_all'
restart_on='restart'
type='service'>
<service_fmri value='svc:/network/routing/zebra:frr' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr ripd'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60'>
</exec_method>
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/ripd' />
<propval name='legacy-daemon' type='astring'
value='/usr/sfw/sbin/ripdstart' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<propval name='protocol' type='astring' value='ipv4' />
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to FRRouting daemons -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
<!-- Options specific to ripd -->
<propval name='retain' type='boolean' value='false' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
FRRouting: ripd, RIPv1/2 IPv4 routing protocol daemon.
</loctext>
</common_name>
<documentation>
<manpage title='ripd' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
<service
name='network/routing/ripng'
type='service'
version='1'>
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency
name='ipv6-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv6-forwarding' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<!-- ensure that restart of zebra is propogated to daemon -->
<dependency
name='zebra'
grouping='require_all'
restart_on='restart'
type='service'>
<service_fmri value='svc:/network/routing/zebra:frr' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr ripngd'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' >
</exec_method>
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/ripngd' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<propval name='protocol' type='astring' value='ipv6'/>
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to frr daemons -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
<!-- Options specific to ripngd -->
<propval name='retain' type='boolean' value='false' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
frr: ripngd, RIPng IPv6 routing protocol daemon.
</loctext>
</common_name>
<documentation>
<manpage title='ripngd' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
<service
name='network/routing/ospf'
type='service'
version='1'>
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency
name='ipv4-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv4-forwarding' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<!-- ensure that restart of zebra is propogated to daemon -->
<dependency
name='zebra'
grouping='require_all'
restart_on='restart'
type='service'>
<service_fmri value='svc:/network/routing/zebra:frr' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr ospfd'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<!-- ospfd can take a long time to shutdown, due to graceful
shutdown
-->
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='600'>
</exec_method>
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/ospfd' />
<propval name='legacy-daemon' type='astring'
value='/usr/sfw/sbin/ospfdstart' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<propval name='protocol' type='astring' value='ipv4'/>
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to frr daemons -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
frr: ospfd, OSPFv2 IPv4 routing protocol daemon.
</loctext>
</common_name>
<documentation>
<manpage title='ospfd' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
<service
name='network/routing/ospf6'
type='service'
version='1'>
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency
name='ipv6-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv6-forwarding' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<!-- ensure that restart of zebra is propogated to daemon -->
<dependency
name='zebra'
grouping='require_all'
restart_on='restart'
type='service'>
<service_fmri value='svc:/network/routing/zebra:frr' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr ospf6d'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60'>
</exec_method>
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/ospf6d' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<propval name='protocol' type='astring' value='ipv6'/>
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to frr daemons -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
frr: ospf6d, OSPFv3 IPv6 routing protocol daemon.
</loctext>
</common_name>
<documentation>
<manpage title='ospf6d' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
<service
name='network/routing/bgp'
type='service'
version='1'>
<instance name='frr' enabled='false'>
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/usr:default' />
</dependency>
<dependency
name='ipv6-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv6-forwarding' />
</dependency>
<dependency
name='ipv4-forwarding'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/ipv4-forwarding' />
</dependency>
<!-- do not not run unless routing-setup has run -->
<dependency
name='network_routing_setup'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/network/routing-setup' />
</dependency>
<!-- ensure that restart of zebra is propogated to daemon -->
<dependency
name='zebra'
grouping='require_all'
restart_on='restart'
type='service'>
<service_fmri value='svc:/network/routing/zebra:frr' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/frr bgpd'
timeout_seconds='60'>
<method_context>
<method_credential
user='root' group='root'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60' >
</exec_method>
<property_group name='startd'
type='framework'>
<!-- sub-process core dumps shouldn't restart session -->
<propval name='ignore_error'
type='astring' value='core,signal' />
</property_group>
<!-- Properties in this group are used by routeadm (1M) -->
<property_group name='routeadm' type='application'>
<stability value='Unstable' />
<!-- Identifies service as a routing service -->
<propval name='daemon' type='astring'
value='@sbindir@/bgpd' />
<propval name='legacy-daemon' type='astring'
value='/usr/sfw/sbin/bgpdstart' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<property name='protocol' type='astring'>
<astring_list>
<value_node value='ipv4'/>
<value_node value='ipv6'/>
</astring_list>
</property>
</property_group>
<!-- Properties in this group are modifiable via routeadm (1M) -->
<property_group name='routing' type='application'>
<propval name='value_authorization' type='astring'
value='solaris.smf.value.routing' />
<!-- Options common to frr daemons. -->
<!-- The config file to use, if not the default -->
<propval name='config_file' type='astring' value=''/>
<!-- The vty_port to listen on if not the default.
0 to disable -->
<propval name='vty_port' type='integer' value='0' />
<!-- The address to bind the VTY interface to, if not any. -->
<propval name='vty_address' type='astring' value='' />
<!-- The user to switch to after startup, if not the default -->
<propval name='user' type='astring' value='' />
<!-- The group to switch to, if not the default.
If user is specified, this defaults to a group with
same name as user -->
<propval name='group' type='astring' value='' />
<!-- The pidfile to use, if not the default of
@frr_statedir@ -->
<propval name='pid_file' type='astring' value='' />
<!-- Options specific to bgpd -->
<propval name='retain' type='boolean' value='false' />
<propval name='no_kernel' type='boolean' value='false' />
<propval name='bgp_port' type='astring' value='' />
<!--
If enable_zebra is false, it will not be switched
on by the start method.
-->
<propval name='enable_zebra' type='boolean' value='true' />
</property_group>
<property_group name='general' type='framework'>
<!-- to start stop routing services -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.routing' />
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.routing' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>
frr: bgpd, BGP routing protocol daemon.
</loctext>
</common_name>
<documentation>
<manpage title='bgpd' section='1M'
manpath='@mandir@' />
<doc_link name='frrouting.org'
uri='http://www.frrouting.org/' />
</documentation>
</template>
</instance>
<stability value='Unstable' />
</service>
</service_bundle>

View file

@ -1,2 +0,0 @@
PKG="FRRdaemons"
NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ daemons"

View file

@ -1,3 +0,0 @@
PKG=FRRdev
NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ development files"

View file

@ -1,2 +0,0 @@
PKG=FRRdoc
NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ documentation"

View file

@ -1,2 +0,0 @@
PKG=FRRlibs
NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ common runtime libraries"

View file

@ -1,2 +0,0 @@
PKG="FRRsmf"
NAME="@PACKAGE_NAME@ - @PACKAGE_NAME@ SMF support"

View file

@ -1,10 +0,0 @@
ARCH="@host_cpu@"
CATEGORY="system"
VERSION="@PACKAGE_VERSION@,REV=@CONFDATE@"
VENDOR="http://www.frrouting.org/"
HOTLINE="@PACKAGE_BUGREPORT@"
EMAIL=maintainers@frrouting.org
DESC="@PACKAGE_NAME@ Routing Protocols"
MAXINST=1
CLASSES="none preserve renamenew manifest"
BASEDIR=/

View file

@ -1,20 +0,0 @@
i pkginfo=$abs_builddir/pkginfo.daemons.full
i depend=$abs_builddir/depend.daemons
i copying=$abs_top_srcdir/COPYING
d none @sbindir@=$DESTDIR/@sbindir@ 0755 root bin
f none @sbindir@/zebra=$DESTDIR/@sbindir@/zebra 0755 root bin
f none @sbindir@/bgpd=$DESTDIR/@sbindir@/bgpd 0755 root bin
f none @sbindir@/ripd=$DESTDIR/@sbindir@/ripd 0755 root bin
f none @sbindir@/ripngd=$DESTDIR/@sbindir@/ripngd 0755 root bin
f none @sbindir@/ospfd=$DESTDIR/@sbindir@/ospfd 0755 root bin
f none @sbindir@/ospf6d=$DESTDIR/@sbindir@/ospf6d 0755 root bin
f none @sbindir@/watchfrr=$DESTDIR/@sbindir@/watchfrr 0755 root bin
d none @sysconfdir@=$DESTDIR/@sysconfdir@ 0711 @enable_user@ @enable_group@
f none @sysconfdir@/zebra.conf.sample=$DESTDIR/@sysconfdir@/zebra.conf.sample 0644 root bin
f none @sysconfdir@/bgpd.conf.sample=$DESTDIR/@sysconfdir@/bgpd.conf.sample 0644 root bin
f none @sysconfdir@/bgpd.conf.sample2=$DESTDIR/@sysconfdir@/bgpd.conf.sample2 0644 root bin
f none @sysconfdir@/ripd.conf.sample=$DESTDIR/@sysconfdir@/ripd.conf.sample 0644 root bin
f none @sysconfdir@/ripngd.conf.sample=$DESTDIR/@sysconfdir@/ripngd.conf.sample 0644 root bin
f none @sysconfdir@/ospfd.conf.sample=$DESTDIR/@sysconfdir@/ospfd.conf.sample 0644 root bin
f none @sysconfdir@/ospf6d.conf.sample=$DESTDIR/@sysconfdir@/ospf6d.conf.sample 0644 root bin
d none @frr_statedir@=$DESTDIR/@frr_statedir@ 0711 @enable_user@ @enable_group@

View file

@ -1,55 +0,0 @@
i pkginfo=$abs_builddir/pkginfo.dev.full
i depend=$abs_builddir/depend.dev
i copying=$abs_top_srcdir/COPYING
f none @libdir@/libfrr.la=$DESTDIR/@libdir@/libfrr.la 0755 root bin
f none @libdir@/libfrr.a=$DESTDIR/@libdir@/libfrr.a 0644 root bin
f none @libdir@/libfrrospfapiclient.la=$DESTDIR/@libdir@/libfrrospfapiclient.la 0755 root bin
f none @libdir@/libfrrospfapiclient.a=$DESTDIR/@libdir@/libfrrospfapiclient.a 0644 root bin
d none @includedir@=$DESTDIR/@includedir@ 0755 root bin
d none @includedir@/frr=$DESTDIR/@includedir@/frr 0755 root bin
d none @includedir@/frr/ospfd=$DESTDIR/@includedir@/frr/ospfd 0755 root bin
f none @includedir@/frr/ospfd/ospf_api.h=$DESTDIR/@includedir@/frr/ospfd/ospf_api.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_asbr.h=$DESTDIR/@includedir@/frr/ospfd/ospf_asbr.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_dump.h=$DESTDIR/@includedir@/frr/ospfd/ospf_dump.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_lsa.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsa.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_lsdb.h=$DESTDIR/@includedir@/frr/ospfd/ospf_lsdb.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_nsm.h=$DESTDIR/@includedir@/frr/ospfd/ospf_nsm.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_ism.h=$DESTDIR/@includedir@/frr/ospfd/ospf_ism.h 0644 root bin
f none @includedir@/frr/ospfd/ospf_opaque.h=$DESTDIR/@includedir@/frr/ospfd/ospf_opaque.h 0644 root bin
f none @includedir@/frr/ospfd/ospfd.h=$DESTDIR/@includedir@/frr/ospfd/ospfd.h 0644 root bin
f none @includedir@/frr/buffer.h=$DESTDIR/@includedir@/frr/buffer.h 0644 root bin
f none @includedir@/frr/command.h=$DESTDIR/@includedir@/frr/command.h 0644 root bin
f none @includedir@/frr/filter.h=$DESTDIR/@includedir@/frr/filter.h 0644 root bin
f none @includedir@/frr/getopt.h=$DESTDIR/@includedir@/frr/getopt.h 0644 root bin
f none @includedir@/frr/hash.h=$DESTDIR/@includedir@/frr/hash.h 0644 root bin
f none @includedir@/frr/if.h=$DESTDIR/@includedir@/frr/if.h 0644 root bin
f none @includedir@/frr/linklist.h=$DESTDIR/@includedir@/frr/linklist.h 0644 root bin
f none @includedir@/frr/log.h=$DESTDIR/@includedir@/frr/log.h 0644 root bin
f none @includedir@/frr/memory.h=$DESTDIR/@includedir@/frr/memory.h 0644 root bin
f none @includedir@/frr/network.h=$DESTDIR/@includedir@/frr/network.h 0644 root bin
f none @includedir@/frr/prefix.h=$DESTDIR/@includedir@/frr/prefix.h 0644 root bin
f none @includedir@/frr/routemap.h=$DESTDIR/@includedir@/frr/routemap.h 0644 root bin
f none @includedir@/frr/distribute.h=$DESTDIR/@includedir@/frr/distribute.h 0644 root bin
f none @includedir@/frr/sockunion.h=$DESTDIR/@includedir@/frr/sockunion.h 0644 root bin
f none @includedir@/frr/str.h=$DESTDIR/@includedir@/frr/str.h 0644 root bin
f none @includedir@/frr/stream.h=$DESTDIR/@includedir@/frr/stream.h 0644 root bin
f none @includedir@/frr/table.h=$DESTDIR/@includedir@/frr/table.h 0644 root bin
f none @includedir@/frr/thread.h=$DESTDIR/@includedir@/frr/thread.h 0644 root bin
f none @includedir@/frr/vector.h=$DESTDIR/@includedir@/frr/vector.h 0644 root bin
f none @includedir@/frr/version.h=$DESTDIR/@includedir@/frr/version.h 0644 root bin
f none @includedir@/frr/vty.h=$DESTDIR/@includedir@/frr/vty.h 0644 root bin
f none @includedir@/frr/zebra.h=$DESTDIR/@includedir@/frr/zebra.h 0644 root bin
f none @includedir@/frr/plist.h=$DESTDIR/@includedir@/frr/plist.h 0644 root bin
f none @includedir@/frr/zclient.h=$DESTDIR/@includedir@/frr/zclient.h 0644 root bin
f none @includedir@/frr/sockopt.h=$DESTDIR/@includedir@/frr/sockopt.h 0644 root bin
f none @includedir@/frr/smux.h=$DESTDIR/@includedir@/frr/smux.h 0644 root bin
f none @includedir@/frr/md5.h=$DESTDIR/@includedir@/frr/md5.h 0644 root bin
f none @includedir@/frr/if_rmap.h=$DESTDIR/@includedir@/frr/if_rmap.h 0644 root bin
f none @includedir@/frr/keychain.h=$DESTDIR/@includedir@/frr/keychain.h 0644 root bin
f none @includedir@/frr/privs.h=$DESTDIR/@includedir@/frr/privs.h 0644 root bin
f none @includedir@/frr/sigevent.h=$DESTDIR/@includedir@/frr/sigevent.h 0644 root bin
f none @includedir@/frr/pqueue.h=$DESTDIR/@includedir@/frr/pqueue.h 0644 root bin
f none @includedir@/frr/jhash.h=$DESTDIR/@includedir@/frr/jhash.h 0644 root bin
f none @includedir@/frr/zassert.h=$DESTDIR/@includedir@/frr/zassert.h 0644 root bin
d none @includedir@/frr/ospfapi=$DESTDIR/@includedir@/frr/ospfapi 0755 root bin
f none @includedir@/frr/ospfapi/ospf_apiclient.h=$DESTDIR/@includedir@/frr/ospfapi/ospf_apiclient.h 0644 root bin

View file

@ -1,17 +0,0 @@
i pkginfo=$abs_builddir/pkginfo.doc.full
i depend=$abs_builddir/depend.doc
i copying=$abs_top_srcdir/COPYING
d none @infodir@=$DESTDIR/@infodir@ 0755 root bin
#f none @infodir@/dir=$DESTDIR/@infodir@/dir 0644 root bin
f none @infodir@/frr.info=$DESTDIR/@infodir@/frr.info 0644 root bin
d none @mandir@=$DESTDIR/@mandir@ 0755 root bin
d none @mandir@/man1=$DESTDIR/@mandir@/man1 0755 root bin
f none @mandir@/man1/vtysh.1=$DESTDIR/@mandir@/man1/vtysh.1 0644 root bin
d none @mandir@/man8=$DESTDIR/@mandir@/man8 0755 root bin
f none @mandir@/man8/frr-bgpd.8=$DESTDIR/@mandir@/man8/bgpd.8 0644 root bin
f none @mandir@/man8/frr-ospf6d.8=$DESTDIR/@mandir@/man8/frr-ospf6d.8 0644 root bin
f none @mandir@/man8/frr-ospfd.8=$DESTDIR/@mandir@/man8/frr-ospfd.8 0644 root bin
f none @mandir@/man8/frr-ripd.8=$DESTDIR/@mandir@/man8/frr-ripd.8 0644 root bin
f none @mandir@/man8/frr-ripngd.8=$DESTDIR/@mandir@/man8/frr-ripngd.8 0644 root bin
f none @mandir@/man8/frr-zebra.8=$DESTDIR/@mandir@/man8/frr-zebra.8 0644 root bin
f none @mandir@/man8/frr-isisd.8=$DESTDIR/@mandir@/man8/frr-isisd.8 0644 root bin

View file

@ -1,10 +0,0 @@
i pkginfo=$abs_builddir/pkginfo.libs.full
i depend=$abs_builddir/depend.libs
i copying=$abs_top_srcdir/COPYING
d none @libdir@=$DESTDIR/@libdir@ 0755 root bin
s none @libdir@/libfrr.so.0=libfrr.so.0.0.0
f none @libdir@/libfrr.so.0.0.0=$DESTDIR/@libdir@/libfrr.so.0.0.0 0755 root bin
s none @libdir@/libfrr.so=libfrr.so.0.0.0
f none @libdir@/libfrrospfapiclient.so.0.0.0=$DESTDIR/@libdir@/libfrrospfapiclient.so.0.0.0 0755 root bin
s none @libdir@/libfrrospfapiclient.so.0=libfrrospfapiclient.so.0.0.0
s none @libdir@/libfrrospfapiclient.so=libfrrospfapiclient.so.0.0.0

View file

@ -1,8 +0,0 @@
i pkginfo=$abs_builddir/pkginfo.smf.full
i depend=$abs_builddir/depend.smf
i copying=$abs_top_srcdir/COPYING
i i.manifest
i r.manifest
f manifest var/svc/manifest/network/frr.xml 0444 root bin
#f none var/svc/profile/@PACKAGE_TARNAME@_options.xml=$abs_builddir/options.xml 0755 root sys
f none lib/svc/method/frr=$abs_builddir/frr.init 0755 root bin

View file

@ -1,53 +0,0 @@
#
# solaris
#
.PHONY: solaris/all
if SOLARIS
all: solaris/all
solaris/all:
@make -s -C solaris all
endif
CLEANFILES += \
solaris/frr.xml \
solaris/frr.init \
solaris/pkginfo.tmpl \
solaris/prototype.daemons \
solaris/prototype.dev \
solaris/prototype.doc \
solaris/prototype.libs \
solaris/prototype.smf \
solaris/pkginfo.daemons.tmpl \
solaris/pkginfo.dev.tmpl \
solaris/pkginfo.doc.tmpl \
solaris/pkginfo.libs.tmpl \
solaris/pkginfo.smf.tmpl \
solaris/depend.daemons \
solaris/depend.dev \
solaris/depend.doc \
solaris/depend.libs \
solaris/depend.smf \
# end
EXTRA_DIST += \
solaris/frr.xml.in \
solaris/frr.init.in \
solaris/pkginfo.tmpl.in \
solaris/prototype.daemons.in \
solaris/prototype.dev.in \
solaris/prototype.doc.in \
solaris/prototype.libs.in \
solaris/prototype.smf.in \
solaris/pkginfo.daemons.tmpl.in \
solaris/pkginfo.dev.tmpl.in \
solaris/pkginfo.doc.tmpl.in \
solaris/pkginfo.libs.tmpl.in \
solaris/pkginfo.smf.tmpl.in \
solaris/depend.daemons.in \
solaris/depend.dev.in \
solaris/depend.doc.in \
solaris/depend.libs.in \
solaris/depend.smf.in \
solaris/README.txt \
# end

View file

@ -34,12 +34,7 @@
* should be added by autoconf if not present? * should be added by autoconf if not present?
*/ */
#ifndef s6_addr32 #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 #define s6_addr32 __u6_addr.__u6_addr32
#endif /* SUNOS_5 */
#endif /*s6_addr32*/ #endif /*s6_addr32*/
struct thread_master *master; struct thread_master *master;

View file

@ -17,16 +17,12 @@ TESTS_BGPD =
endif endif
if ISISD if ISISD
if SOLARIS
TESTS_ISISD =
else
TESTS_ISISD = \ TESTS_ISISD = \
tests/isisd/test_fuzz_isis_tlv \ tests/isisd/test_fuzz_isis_tlv \
tests/isisd/test_isis_lspdb \ tests/isisd/test_isis_lspdb \
tests/isisd/test_isis_spf \ tests/isisd/test_isis_spf \
tests/isisd/test_isis_vertex_queue \ tests/isisd/test_isis_vertex_queue \
# end # end
endif
else else
TESTS_ISISD = TESTS_ISISD =
endif endif

View file

@ -1,353 +0,0 @@
/*
* Interface looking up by ioctl () on Solaris.
* Copyright (C) 1997, 98 Kunihiro Ishiguro
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#ifdef SUNOS_5
#include "if.h"
#include "sockunion.h"
#include "prefix.h"
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
#include "zebra_memory.h"
#include "log.h"
#include "privs.h"
#include "vrf.h"
#include "vty.h"
#include "lib_errors.h"
#include "zebra/interface.h"
#include "zebra/ioctl_solaris.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/zebra_errors.h"
static int if_get_addr(struct interface *, struct sockaddr *, const char *);
static void interface_info_ioctl(struct interface *);
extern struct zebra_privs_t zserv_privs;
static int interface_list_ioctl(int af)
{
int ret;
int sock;
#define IFNUM_BASE 32
struct lifnum lifn;
int ifnum;
struct lifreq *lifreq;
struct lifconf lifconf;
struct interface *ifp;
int n;
size_t needed, lastneeded = 0;
char *buf = NULL;
frr_with_privs(&zserv_privs) {
sock = socket(af, SOCK_DGRAM, 0);
}
if (sock < 0) {
flog_err_sys(EC_LIB_SOCKET, "Can't make %s socket stream: %s",
(af == AF_INET ? "AF_INET" : "AF_INET6"),
safe_strerror(errno));
return -1;
}
calculate_lifc_len:
frr_with_privs(&zserv_privs) {
lifn.lifn_family = af;
lifn.lifn_flags = LIFC_NOXMIT;
/* we want NOXMIT interfaces too */
ret = ioctl(sock, SIOCGLIFNUM, &lifn);
}
if (ret < 0) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"interface_list_ioctl: SIOCGLIFNUM failed %s",
safe_strerror(errno));
close(sock);
return -1;
}
ifnum = lifn.lifn_count;
/*
* When calculating the buffer size needed, add a small number
* of interfaces to those we counted. We do this to capture
* the interface status of potential interfaces which may have
* been plumbed between the SIOCGLIFNUM and the SIOCGLIFCONF.
*/
needed = (ifnum + 4) * sizeof(struct lifreq);
if (needed > lastneeded || needed < lastneeded / 2) {
if (buf != NULL)
XFREE(MTYPE_TMP, buf);
buf = XMALLOC(MTYPE_TMP, needed);
}
lastneeded = needed;
lifconf.lifc_family = af;
lifconf.lifc_flags = LIFC_NOXMIT;
lifconf.lifc_len = needed;
lifconf.lifc_buf = buf;
frr_with_privs(&zserv_privs) {
ret = ioctl(sock, SIOCGLIFCONF, &lifconf);
}
if (ret < 0) {
if (errno == EINVAL)
goto calculate_lifc_len;
flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFCONF: %s",
safe_strerror(errno));
goto end;
}
/* Allocate interface. */
lifreq = lifconf.lifc_req;
for (n = 0; n < lifconf.lifc_len; n += sizeof(struct lifreq)) {
/* we treat Solaris logical interfaces as addresses, because
* that is
* how PF_ROUTE on Solaris treats them. Hence we can not
* directly use
* the lifreq_name to get the ifp. We need to normalise the
* name
* before attempting get.
*
* Solaris logical interface names are in the form of:
* <interface name>:<logical interface id>
*/
unsigned int normallen = 0;
uint64_t lifflags;
/* We should exclude ~IFF_UP interfaces, as we'll find out about
* them
* coming up later through RTM_NEWADDR message on the route
* socket.
*/
if (if_get_flags_direct(lifreq->lifr_name, &lifflags,
lifreq->lifr_addr.ss_family)
|| !CHECK_FLAG(lifflags, IFF_UP)) {
lifreq++;
continue;
}
/* Find the normalised name */
while ((normallen < sizeof(lifreq->lifr_name))
&& (*(lifreq->lifr_name + normallen) != '\0')
&& (*(lifreq->lifr_name + normallen) != ':'))
normallen++;
ifp = if_get_by_name(lifreq->lifr_name, VRF_DEFAULT);
if (lifreq->lifr_addr.ss_family == AF_INET)
ifp->flags |= IFF_IPV4;
if (lifreq->lifr_addr.ss_family == AF_INET6) {
ifp->flags |= IFF_IPV6;
}
if_add_update(ifp);
interface_info_ioctl(ifp);
/* If a logical interface pass the full name so it can be
* as a label on the address
*/
if (*(lifreq->lifr_name + normallen) != '\0')
if_get_addr(ifp, (struct sockaddr *)&lifreq->lifr_addr,
lifreq->lifr_name);
else
if_get_addr(ifp, (struct sockaddr *)&lifreq->lifr_addr,
NULL);
/* Poke the interface flags. Lets IFF_UP mangling kick in */
if_flags_update(ifp, ifp->flags);
lifreq++;
}
end:
close(sock);
XFREE(MTYPE_TMP, lifconf.lifc_buf);
return ret;
}
/* Get interface's index by ioctl. */
static int if_get_index(struct interface *ifp)
{
int ret;
struct lifreq lifreq;
lifreq_set_name(&lifreq, ifp->name);
if (ifp->flags & IFF_IPV4)
ret = AF_IOCTL(AF_INET, SIOCGLIFINDEX, (caddr_t)&lifreq);
else if (ifp->flags & IFF_IPV6)
ret = AF_IOCTL(AF_INET6, SIOCGLIFINDEX, (caddr_t)&lifreq);
else
ret = -1;
if (ret < 0) {
flog_err_sys(EC_LIB_SYSTEM_CALL, "SIOCGLIFINDEX(%s) failed",
ifp->name);
return ret;
}
/* OK we got interface index. */
#ifdef ifr_ifindex
if_set_index(ifp, lifreq.lifr_ifindex);
#else
if_set_index(ifp, lifreq.lifr_index);
#endif
return ifp->ifindex;
}
/* Interface address lookup by ioctl. This function only looks up
IPv4 address. */
#define ADDRLEN(sa) \
(((sa)->sa_family == AF_INET ? sizeof(struct sockaddr_in) \
: sizeof(struct sockaddr_in6)))
#define SIN(s) ((struct sockaddr_in *)(s))
#define SIN6(s) ((struct sockaddr_in6 *)(s))
/* Retrieve address information for the given ifp */
static int if_get_addr(struct interface *ifp, struct sockaddr *addr,
const char *label)
{
int ret;
struct lifreq lifreq;
struct sockaddr_storage mask, dest;
char *dest_pnt = NULL;
uint8_t prefixlen = 0;
afi_t af;
int flags = 0;
/* Interface's name and address family.
* We need to use the logical interface name / label, if we've been
* given one, in order to get the right address
*/
strlcpy(lifreq.lifr_name, (label ? label : ifp->name),
sizeof(lifreq.lifr_name));
/* Interface's address. */
memcpy(&lifreq.lifr_addr, addr, ADDRLEN(addr));
af = addr->sa_family;
/* Point to point or broad cast address pointer init. */
dest_pnt = NULL;
if (AF_IOCTL(af, SIOCGLIFDSTADDR, (caddr_t)&lifreq) >= 0) {
memcpy(&dest, &lifreq.lifr_dstaddr, ADDRLEN(addr));
if (af == AF_INET)
dest_pnt = (char *)&(SIN(&dest)->sin_addr);
else
dest_pnt = (char *)&(SIN6(&dest)->sin6_addr);
flags = ZEBRA_IFA_PEER;
}
if (af == AF_INET) {
ret = if_ioctl(SIOCGLIFNETMASK, (caddr_t)&lifreq);
if (ret < 0) {
if (errno != EADDRNOTAVAIL) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFNETMASK (%s) fail: %s",
ifp->name, safe_strerror(errno));
return ret;
}
return 0;
}
memcpy(&mask, &lifreq.lifr_addr, ADDRLEN(addr));
prefixlen = ip_masklen(SIN(&mask)->sin_addr);
if (!dest_pnt
&& (if_ioctl(SIOCGLIFBRDADDR, (caddr_t)&lifreq) >= 0)) {
memcpy(&dest, &lifreq.lifr_broadaddr,
sizeof(struct sockaddr_in));
dest_pnt = (char *)&SIN(&dest)->sin_addr;
}
} else if (af == AF_INET6) {
if (if_ioctl_ipv6(SIOCGLIFSUBNET, (caddr_t)&lifreq) < 0) {
if (ifp->flags & IFF_POINTOPOINT)
prefixlen = IPV6_MAX_BITLEN;
else
flog_err_sys(EC_LIB_SYSTEM_CALL,
"SIOCGLIFSUBNET (%s) fail: %s",
ifp->name, safe_strerror(errno));
} else {
prefixlen = lifreq.lifr_addrlen;
}
}
/* Set address to the interface. */
if (af == AF_INET)
connected_add_ipv4(ifp, flags, &SIN(addr)->sin_addr, prefixlen,
(struct in_addr *)dest_pnt, label,
METRIC_MAX);
else if (af == AF_INET6)
connected_add_ipv6(ifp, flags, &SIN6(addr)->sin6_addr, NULL,
prefixlen, label, METRIC_MAX);
return 0;
}
/* Fetch interface information via ioctl(). */
static void interface_info_ioctl(struct interface *ifp)
{
if_get_index(ifp);
if_get_flags(ifp);
if_get_mtu(ifp);
if_get_metric(ifp);
}
/* Lookup all interface information. */
void interface_list(struct zebra_ns *zns)
{
if (zns->ns_id != NS_DEFAULT) {
zlog_debug("interface_list: ignore NS %u", zns->ns_id);
return;
}
interface_list_ioctl(AF_INET);
interface_list_ioctl(AF_INET6);
interface_list_ioctl(AF_UNSPEC);
}
struct connected *if_lookup_linklocal(struct interface *ifp)
{
struct listnode *node;
struct connected *ifc;
if (ifp == NULL)
return NULL;
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
if ((ifc->address->family == AF_INET6)
&& (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)))
return ifc;
}
return NULL;
}
#endif /* SUNOS_5 */

View file

@ -21,7 +21,7 @@
#include <zebra.h> #include <zebra.h>
#if !defined(GNU_LINUX) && !defined(OPEN_BSD) && !defined(SUNOS_5) #if !defined(GNU_LINUX) && !defined(OPEN_BSD)
#include "if.h" #include "if.h"
#include "sockunion.h" #include "sockunion.h"
@ -144,4 +144,4 @@ void interface_list(struct zebra_ns *zns)
XFREE(MTYPE_TMP, ref); XFREE(MTYPE_TMP, ref);
} }
#endif /* !defined(GNU_LINUX) && !defined(OPEN_BSD) && !defined(SUNOS_5) */ #endif /* !defined(GNU_LINUX) && !defined(OPEN_BSD) */

View file

@ -464,17 +464,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
*/ */
static void if_flags_mangle(struct interface *ifp, uint64_t *newflags) static void if_flags_mangle(struct interface *ifp, uint64_t *newflags)
{ {
#ifdef SUNOS_5 return;
struct zebra_if *zif = ifp->info;
zif->primary_state = *newflags & (IFF_UP & 0xff);
if (CHECK_FLAG(zif->primary_state, IFF_UP)
|| listcount(ifp->connected) > 0)
SET_FLAG(*newflags, IFF_UP);
else
UNSET_FLAG(*newflags, IFF_UP);
#endif /* SUNOS_5 */
} }
/* Update the flags field of the ifp with the new flag set provided. /* Update the flags field of the ifp with the new flag set provided.

View file

@ -334,15 +334,6 @@ struct zebra_if {
}; };
#endif #endif
#ifdef SUNOS_5
/* the real IFF_UP state of the primary interface.
* need this to differentiate between all interfaces being
* down (but primary still plumbed) and primary having gone
* ~IFF_UP, and all addresses gone.
*/
uint8_t primary_state;
#endif /* SUNOS_5 */
/* ptm enable configuration */ /* ptm enable configuration */
uint8_t ptm_enable; uint8_t ptm_enable;

View file

@ -36,8 +36,6 @@
#include "zebra/zebra_errors.h" #include "zebra/zebra_errors.h"
#include "zebra/debug.h" #include "zebra/debug.h"
#ifndef SUNOS_5
#ifdef HAVE_BSD_LINK_DETECT #ifdef HAVE_BSD_LINK_DETECT
#include <net/if_media.h> #include <net/if_media.h>
#endif /* HAVE_BSD_LINK_DETECT*/ #endif /* HAVE_BSD_LINK_DETECT*/
@ -166,11 +164,7 @@ void if_get_mtu(struct interface *ifp)
return; return;
} }
#ifdef SUNOS_5
ifp->mtu6 = ifp->mtu = ifreq.ifr_metric;
#else
ifp->mtu6 = ifp->mtu = ifreq.ifr_mtu; ifp->mtu6 = ifp->mtu = ifreq.ifr_mtu;
#endif /* SUNOS_5 */
/* propogate */ /* propogate */
zebra_interface_up_update(ifp); zebra_interface_up_update(ifp);
@ -378,11 +372,7 @@ int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx)
} }
mask.sin_family = p->family; mask.sin_family = p->family;
#ifdef SUNOS_5
memcpy(&mask, &ifreq.ifr_addr, sizeof(mask));
#else
memcpy(&ifreq.ifr_addr, &mask, sizeof(struct sockaddr_in)); memcpy(&ifreq.ifr_addr, &mask, sizeof(struct sockaddr_in));
#endif /* SUNOS5 */
ret = if_ioctl(SIOCSIFNETMASK, (caddr_t)&ifreq); ret = if_ioctl(SIOCSIFNETMASK, (caddr_t)&ifreq);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -620,5 +610,3 @@ static int if_unset_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
#endif /* HAVE_STRUCT_IN6_ALIASREQ */ #endif /* HAVE_STRUCT_IN6_ALIASREQ */
#endif /* LINUX_IPV6 */ #endif /* LINUX_IPV6 */
#endif /* !SUNOS_5 */

View file

@ -38,19 +38,8 @@ extern void if_get_flags(struct interface *);
extern void if_get_metric(struct interface *); extern void if_get_metric(struct interface *);
extern void if_get_mtu(struct interface *); extern void if_get_mtu(struct interface *);
#ifdef SOLARIS_IPV6
extern int if_ioctl_ipv6(unsigned long, caddr_t);
extern struct connected *if_lookup_linklocal(struct interface *);
#define AF_IOCTL(af, request, buffer) \
((af) == AF_INET ? if_ioctl(request, buffer) \
: if_ioctl_ipv6(request, buffer))
#else /* SOLARIS_IPV6 */
#define AF_IOCTL(af, request, buffer) if_ioctl(request, buffer) #define AF_IOCTL(af, request, buffer) if_ioctl(request, buffer)
#endif /* SOLARIS_IPV6 */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -1,441 +0,0 @@
/*
* Common ioctl functions for Solaris.
* Copyright (C) 1997, 98 Kunihiro Ishiguro
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#ifdef SUNOS_5
#include "linklist.h"
#include "if.h"
#include "prefix.h"
#include "ioctl.h"
#include "log.h"
#include "privs.h"
#include "vty.h"
#include "vrf.h"
#include "lib_errors.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/interface.h"
#include "zebra/ioctl_solaris.h"
#include "zebra/zebra_errors.h"
#include "zebra/debug.h"
extern struct zebra_privs_t zserv_privs;
/* Prototypes */
static int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx);
static int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx);
static int if_set_prefix6_ctx(const struct zebra_dplane_ctx *ctx);
static int if_unset_prefix6_ctx(const struct zebra_dplane_ctx *ctx);
/* clear and set interface name string */
void lifreq_set_name(struct lifreq *lifreq, const char *ifname)
{
strlcpy(lifreq->lifr_name, ifname, sizeof(lifreq->lifr_name));
}
int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id)
{
return if_ioctl(request, buffer);
}
/* call ioctl system call */
int if_ioctl(unsigned long request, caddr_t buffer)
{
int sock;
int ret;
int err;
frr_with_privs(&zserv_privs) {
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
zlog_err("Cannot create UDP socket: %s",
safe_strerror(errno));
exit(1);
}
if ((ret = ioctl(sock, request, buffer)) < 0)
err = errno;
}
close(sock);
if (ret < 0) {
errno = err;
return ret;
}
return 0;
}
int if_ioctl_ipv6(unsigned long request, caddr_t buffer)
{
int sock;
int ret;
int err;
frr_with_privs(&zserv_privs) {
sock = socket(AF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
zlog_err("Cannot create IPv6 datagram socket: %s",
safe_strerror(errno));
exit(1);
}
if ((ret = ioctl(sock, request, buffer)) < 0)
err = errno;
}
close(sock);
if (ret < 0) {
errno = err;
return ret;
}
return 0;
}
/*
* get interface metric
* -- if value is not avaliable set -1
*/
void if_get_metric(struct interface *ifp)
{
struct lifreq lifreq;
int ret;
lifreq_set_name(&lifreq, ifp->name);
if (ifp->flags & IFF_IPV4)
ret = AF_IOCTL(AF_INET, SIOCGLIFMETRIC, (caddr_t)&lifreq);
#ifdef SOLARIS_IPV6
else if (ifp->flags & IFF_IPV6)
ret = AF_IOCTL(AF_INET6, SIOCGLIFMETRIC, (caddr_t)&lifreq);
#endif /* SOLARIS_IPV6 */
else
ret = -1;
if (ret < 0)
return;
ifp->metric = lifreq.lifr_metric;
if (ifp->metric == 0)
ifp->metric = 1;
}
/* get interface MTU */
void if_get_mtu(struct interface *ifp)
{
struct lifreq lifreq;
int ret;
uint8_t changed = 0;
if (ifp->flags & IFF_IPV4) {
lifreq_set_name(&lifreq, ifp->name);
ret = AF_IOCTL(AF_INET, SIOCGLIFMTU, (caddr_t)&lifreq);
if (ret < 0) {
zlog_info(
"Can't lookup mtu on %s by ioctl(SIOCGLIFMTU)",
ifp->name);
ifp->mtu = -1;
} else {
ifp->mtu = lifreq.lifr_metric;
changed = 1;
}
}
if (ifp->flags & IFF_IPV6) {
memset(&lifreq, 0, sizeof(lifreq));
lifreq_set_name(&lifreq, ifp->name);
ret = AF_IOCTL(AF_INET6, SIOCGLIFMTU, (caddr_t)&lifreq);
if (ret < 0) {
zlog_info(
"Can't lookup mtu6 on %s by ioctl(SIOCGIFMTU)",
ifp->name);
ifp->mtu6 = -1;
} else {
ifp->mtu6 = lifreq.lifr_metric;
changed = 1;
}
}
if (changed)
zebra_interface_up_update(ifp);
}
/*
*
*/
enum zebra_dplane_result kernel_address_update_ctx(
struct zebra_dplane_ctx *ctx)
{
int ret = -1;
const struct prefix *p;
p = dplane_ctx_get_intf_addr(ctx);
if (dplane_ctx_get_op(ctx) == DPLANE_OP_ADDR_INSTALL) {
if (p->family == AF_INET)
ret = if_set_prefix_ctx(ctx);
else
ret = if_set_prefix6_ctx(ctx);
} else if (dplane_ctx_get_op(ctx) == DPLANE_OP_ADDR_UNINSTALL) {
if (p->family == AF_INET)
ret = if_unset_prefix_ctx(ctx);
else
ret = if_unset_prefix6_ctx(ctx);
} else {
if (IS_ZEBRA_DEBUG_DPLANE)
zlog_debug("Invalid op in interface-addr install");
}
return (ret == 0 ?
ZEBRA_DPLANE_REQUEST_SUCCESS : ZEBRA_DPLANE_REQUEST_FAILURE);
}
/* Set up interface's address, netmask (and broadcast? ).
Solaris uses ifname:number semantics to set IP address aliases. */
static int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx)
{
int ret;
struct ifreq ifreq;
struct sockaddr_in addr, broad, mask;
struct prefix_ipv4 ifaddr;
struct prefix_ipv4 *p;
p = (struct prefix_ipv4 *)dplane_ctx_get_intf_addr(ctx);
ifaddr = *p;
strlcpy(ifreq.ifr_name, dplane_ctx_get_ifname(ctx),
sizeof(ifreq.ifr_name));
addr.sin_addr = p->prefix;
addr.sin_family = p->family;
memcpy(&ifreq.ifr_addr, &addr, sizeof(struct sockaddr_in));
ret = if_ioctl(SIOCSIFADDR, (caddr_t)&ifreq);
if (ret < 0)
return ret;
/* We need mask for make broadcast addr. */
masklen2ip(p->prefixlen, &mask.sin_addr);
if (dplane_ctx_intf_is_broadcast(ctx)) {
apply_mask_ipv4(&ifaddr);
addr.sin_addr = ifaddr.prefix;
broad.sin_addr.s_addr =
(addr.sin_addr.s_addr | ~mask.sin_addr.s_addr);
broad.sin_family = p->family;
memcpy(&ifreq.ifr_broadaddr, &broad,
sizeof(struct sockaddr_in));
ret = if_ioctl(SIOCSIFBRDADDR, (caddr_t)&ifreq);
if (ret < 0)
return ret;
}
mask.sin_family = p->family;
#ifdef SUNOS_5
memcpy(&mask, &ifreq.ifr_addr, sizeof(mask));
#else
memcpy(&ifreq.ifr_netmask, &mask, sizeof(struct sockaddr_in));
#endif /* SUNOS_5 */
ret = if_ioctl(SIOCSIFNETMASK, (caddr_t)&ifreq);
return ((ret < 0) ? ret : 0);
}
/* Set up interface's address, netmask (and broadcast).
Solaris uses ifname:number semantics to set IP address aliases. */
static int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
{
int ret;
struct ifreq ifreq;
struct sockaddr_in addr;
struct prefix_ipv4 *p;
p = (struct prefix_ipv4 *)dplane_ctx_get_intf_addr(ctx);
strlcpy(ifreq.ifr_name, dplane_ctx_get_ifname(ctx),
sizeof(ifreq.ifr_name));
memset(&addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = p->family;
memcpy(&ifreq.ifr_addr, &addr, sizeof(struct sockaddr_in));
ret = if_ioctl(SIOCSIFADDR, (caddr_t)&ifreq);
if (ret < 0)
return ret;
return 0;
}
/* Get just the flags for the given name.
* Used by the normal 'if_get_flags' function, as well
* as the bootup interface-list code, which has to peek at per-address
* flags in order to figure out which ones should be ignored..
*/
int if_get_flags_direct(const char *ifname, uint64_t *flags, unsigned int af)
{
struct lifreq lifreq;
int ret;
lifreq_set_name(&lifreq, ifname);
ret = AF_IOCTL(af, SIOCGLIFFLAGS, (caddr_t)&lifreq);
if (ret)
zlog_debug("%s: ifname %s, error %s (%d)", __func__, ifname,
safe_strerror(errno), errno);
*flags = lifreq.lifr_flags;
return ret;
}
/* get interface flags */
void if_get_flags(struct interface *ifp)
{
int ret4 = 0, ret6 = 0;
uint64_t newflags = 0;
uint64_t tmpflags;
if (ifp->flags & IFF_IPV4) {
ret4 = if_get_flags_direct(ifp->name, &tmpflags, AF_INET);
if (!ret4)
newflags |= tmpflags;
else if (errno == ENXIO) {
/* it's gone */
UNSET_FLAG(ifp->flags, IFF_UP);
if_flags_update(ifp, ifp->flags);
}
}
if (ifp->flags & IFF_IPV6) {
ret6 = if_get_flags_direct(ifp->name, &tmpflags, AF_INET6);
if (!ret6)
newflags |= tmpflags;
else if (errno == ENXIO) {
/* it's gone */
UNSET_FLAG(ifp->flags, IFF_UP);
if_flags_update(ifp, ifp->flags);
}
}
/* only update flags if one of above succeeded */
if (!(ret4 && ret6))
if_flags_update(ifp, newflags);
}
/* Set interface flags */
int if_set_flags(struct interface *ifp, uint64_t flags)
{
int ret;
struct lifreq lifreq;
lifreq_set_name(&lifreq, ifp->name);
lifreq.lifr_flags = ifp->flags;
lifreq.lifr_flags |= flags;
if (ifp->flags & IFF_IPV4)
ret = AF_IOCTL(AF_INET, SIOCSLIFFLAGS, (caddr_t)&lifreq);
else if (ifp->flags & IFF_IPV6)
ret = AF_IOCTL(AF_INET6, SIOCSLIFFLAGS, (caddr_t)&lifreq);
else
ret = -1;
if (ret < 0)
zlog_info("can't set interface flags on %s: %s", ifp->name,
safe_strerror(errno));
else
ret = 0;
return ret;
}
/* Unset interface's flag. */
int if_unset_flags(struct interface *ifp, uint64_t flags)
{
int ret;
struct lifreq lifreq;
lifreq_set_name(&lifreq, ifp->name);
lifreq.lifr_flags = ifp->flags;
lifreq.lifr_flags &= ~flags;
if (ifp->flags & IFF_IPV4)
ret = AF_IOCTL(AF_INET, SIOCSLIFFLAGS, (caddr_t)&lifreq);
else if (ifp->flags & IFF_IPV6)
ret = AF_IOCTL(AF_INET6, SIOCSLIFFLAGS, (caddr_t)&lifreq);
else
ret = -1;
if (ret < 0)
zlog_info("can't unset interface flags");
else
ret = 0;
return ret;
}
/* Interface's address add/delete functions. */
static int if_set_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
{
char addrbuf[PREFIX_STRLEN];
prefix2str(dplane_ctx_get_intf_addr(ctx), addrbuf, sizeof(addrbuf));
flog_warn(EC_LIB_DEVELOPMENT, "Can't set %s on interface %s",
addrbuf, dplane_ctx_get_ifname(ctx));
return 0;
}
static int if_unset_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
{
char addrbuf[PREFIX_STRLEN];
prefix2str(dplane_ctx_get_intf_addr(ctx), addrbuf, sizeof(addrbuf));
flog_warn(EC_LIB_DEVELOPMENT, "Can't delete %s on interface %s",
addrbuf, dplane_ctx_get_ifname(ctx));
return 0;
}
#endif /* SUNOS_5 */

View file

@ -1,36 +0,0 @@
/*
* Interface looking up by ioctl () on Solaris.
* Copyright (C) 1999 Kunihiro Ishiguro
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _ZEBRA_IF_IOCTL_SOLARIS_H
#define _ZEBRA_IF_IOCTL_SOLARIS_H
#ifdef __cplusplus
extern "C" {
#endif
void lifreq_set_name(struct lifreq *, const char *);
int if_get_flags_direct(const char *, uint64_t *, unsigned int af);
#ifdef __cplusplus
}
#endif
#endif /* _ZEBRA_IF_IOCTL_SOLARIS_H */

View file

@ -1,156 +0,0 @@
/*
* ipforward value get function for solaris.
* Copyright (C) 1997 Kunihiro Ishiguro
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#ifdef SUNOS_5
#include "log.h"
#include "prefix.h"
#include "lib_errors.h"
#include "privs.h"
#include "zebra/ipforward.h"
#include "zebra/zebra_errors.h"
/*
** Solaris should define IP_DEV_NAME in <inet/ip.h>, but we'll save
** configure.in changes for another day. We can use the same device
** for both IPv4 and IPv6.
*/
/* #include <inet/ip.h> */
#ifndef IP_DEV_NAME
#define IP_DEV_NAME "/dev/ip"
#endif
extern struct zebra_privs_t zserv_privs;
/* This is a limited ndd style function that operates one integer
** value only. Errors return -1. ND_SET commands return 0 on
** success. ND_GET commands return the value on success (which could
** be -1 and be confused for an error). The parameter is the string
** name of the parameter being referenced.
*/
static int solaris_nd(const int cmd, const char *parameter, const int value)
{
#define ND_BUFFER_SIZE 1024
int fd;
char nd_buf[ND_BUFFER_SIZE];
struct strioctl strioctl;
const char *device = IP_DEV_NAME;
int retval;
memset(nd_buf, '\0', ND_BUFFER_SIZE);
/*
** ND_SET takes a NULL delimited list of strings further terminated
** buy a NULL. ND_GET returns a list in a similar layout, although
** here we only use the first result.
*/
if (cmd == ND_SET)
snprintf(nd_buf, ND_BUFFER_SIZE, "%s%c%d%c", parameter, '\0',
value, '\0');
else if (cmd == ND_GET)
snprintf(nd_buf, ND_BUFFER_SIZE, "%s", parameter);
else {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"internal error - inappropriate command given to solaris_nd()%s:%d",
__FILE__, __LINE__);
return -1;
}
strioctl.ic_cmd = cmd;
strioctl.ic_timout = 0;
strioctl.ic_len = ND_BUFFER_SIZE;
strioctl.ic_dp = nd_buf;
frr_with_privs(&zserv_privs) {
if ((fd = open(device, O_RDWR)) < 0) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"failed to open device %s - %s", device,
safe_strerror(errno));
return -1;
}
if (ioctl(fd, I_STR, &strioctl) < 0) {
close(fd);
flog_err_sys(EC_LIB_SYSTEM_CALL,
"ioctl I_STR failed on device %s - %s",
device, safe_strerror(errno));
return -1;
}
close(fd);
}
if (cmd == ND_GET) {
errno = 0;
retval = atoi(nd_buf);
if (errno) {
zlog_debug(
"failed to convert returned value to integer - %s",
safe_strerror(errno));
retval = -1;
}
} else {
retval = 0;
}
return retval;
}
static int solaris_nd_set(const char *parameter, const int value)
{
return solaris_nd(ND_SET, parameter, value);
}
static int solaris_nd_get(const char *parameter)
{
return solaris_nd(ND_GET, parameter, 0);
}
int ipforward(void)
{
return solaris_nd_get("ip_forwarding");
}
int ipforward_on(void)
{
(void)solaris_nd_set("ip_forwarding", 1);
return ipforward();
}
int ipforward_off(void)
{
(void)solaris_nd_set("ip_forwarding", 0);
return ipforward();
}
int ipforward_ipv6(void)
{
return solaris_nd_get("ip6_forwarding");
}
int ipforward_ipv6_on(void)
{
(void)solaris_nd_set("ip6_forwarding", 1);
return ipforward_ipv6();
}
int ipforward_ipv6_off(void)
{
(void)solaris_nd_set("ip6_forwarding", 0);
return ipforward_ipv6();
}
#endif /* SUNOS_5 */

View file

@ -20,7 +20,7 @@
#include <zebra.h> #include <zebra.h>
#if !defined(GNU_LINUX) && !defined(SUNOS_5) #if !defined(GNU_LINUX)
#include "privs.h" #include "privs.h"
#include "zebra/ipforward.h" #include "zebra/ipforward.h"
@ -141,4 +141,4 @@ int ipforward_ipv6_off(void)
return ip6forwarding; return ip6forwarding;
} }
#endif /* !defined(GNU_LINUX) && !defined(SUNOS_5) */ #endif /* !defined(GNU_LINUX) */

View file

@ -80,12 +80,6 @@ extern struct zebra_privs_t zserv_privs;
#define ROUNDUP(a) RT_ROUNDUP(a) #define ROUNDUP(a) RT_ROUNDUP(a)
#endif /* defined(RT_ROUNDUP) */ #endif /* defined(RT_ROUNDUP) */
#if defined(SUNOS_5)
/* Solaris has struct sockaddr_in[6] definitions at 16 / 32 bytes size,
* so the whole concept doesn't really apply. */
#define ROUNDUP(a) (a)
#endif
/* /*
* If ROUNDUP has not yet been defined in terms of platform-provided * If ROUNDUP has not yet been defined in terms of platform-provided
* defines, attempt to cope with heuristics. * defines, attempt to cope with heuristics.
@ -547,18 +541,6 @@ int ifm_read(struct if_msghdr *ifm)
*/ */
cp = (void *)(ifm + 1); cp = (void *)(ifm + 1);
#ifdef SUNOS_5
/*
* XXX This behavior should be narrowed to only the kernel versions
* for which the structures returned do not match the headers.
*
* if_msghdr_t on 64 bit kernels in Solaris 9 and earlier versions
* is 12 bytes larger than the 32 bit version.
*/
if (((struct sockaddr *)cp)->sa_family == AF_UNSPEC)
cp += 12;
#endif
/* Look up for RTA_IFP and skip others. */ /* Look up for RTA_IFP and skip others. */
for (maskbit = 1; maskbit; maskbit <<= 1) { for (maskbit = 1; maskbit; maskbit <<= 1) {
if ((maskbit & ifm->ifm_addrs) == 0) if ((maskbit & ifm->ifm_addrs) == 0)
@ -940,23 +922,6 @@ int ifam_read(struct ifa_msghdr *ifam)
/* Check interface flag for implicit up of the interface. */ /* Check interface flag for implicit up of the interface. */
if_refresh(ifp); if_refresh(ifp);
#ifdef SUNOS_5
/* In addition to lacking IFANNOUNCE, on SUNOS IFF_UP is strange.
* See comments for SUNOS_5 in interface.c::if_flags_mangle.
*
* Here we take care of case where the real IFF_UP was previously
* unset (as kept in struct zebra_if.primary_state) and the mangled
* IFF_UP (ie IFF_UP set || listcount(connected) has now transitioned
* to unset due to the lost non-primary address having DELADDR'd.
*
* we must delete the interface, because in between here and next
* event for this interface-name the administrator could unplumb
* and replumb the interface.
*/
if (!if_is_up(ifp))
if_delete_update(ifp);
#endif /* SUNOS_5 */
return 0; return 0;
} }

View file

@ -1,284 +0,0 @@
/*
* Kernel routing table readup by getmsg(2)
* Copyright (C) 1999 Michael Handler
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#ifdef SUNOS_5
#include "prefix.h"
#include "log.h"
#include "if.h"
#include "vrf.h"
#include "vty.h"
#include "lib_errors.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/zebra_pbr.h"
#include "zebra/zebra_errors.h"
/* Thank you, Solaris, for polluting application symbol namespace. */
#undef hook_register
#undef hook_unregister
#include <sys/stream.h>
#include <sys/tihdr.h>
/* Solaris defines these in both <netinet/in.h> and <inet/in.h>, sigh */
#ifdef SUNOS_5
#include <sys/tiuser.h>
#ifndef T_CURRENT
#define T_CURRENT MI_T_CURRENT
#endif /* T_CURRENT */
#ifndef IRE_CACHE
#define IRE_CACHE 0x0020 /* Cached Route entry */
#endif /* IRE_CACHE */
#ifndef IRE_HOST_REDIRECT
#define IRE_HOST_REDIRECT 0x0200 /* Host route entry from redirects */
#endif /* IRE_HOST_REDIRECT */
#ifndef IRE_CACHETABLE
#define IRE_CACHETABLE (IRE_CACHE | IRE_BROADCAST | IRE_LOCAL | IRE_LOOPBACK)
#endif /* IRE_CACHETABLE */
#undef IPOPT_EOL
#undef IPOPT_NOP
#undef IPOPT_LSRR
#undef IPOPT_RR
#undef IPOPT_SSRR
#endif /* SUNOS_5 */
#include <inet/common.h>
#include <inet/ip.h>
#include <inet/mib2.h>
/* device to read IP routing table from */
#ifndef _PATH_GETMSG_ROUTE
#define _PATH_GETMSG_ROUTE "/dev/ip"
#endif /* _PATH_GETMSG_ROUTE */
#define RT_BUFSIZ 8192
static void handle_route_entry(mib2_ipRouteEntry_t *routeEntry)
{
struct prefix prefix;
struct in_addr tmpaddr;
struct nexthop nh;
uint8_t zebra_flags = 0;
if (routeEntry->ipRouteInfo.re_ire_type & IRE_CACHETABLE)
return;
if (routeEntry->ipRouteInfo.re_ire_type & IRE_HOST_REDIRECT)
zebra_flags |= ZEBRA_FLAG_SELFROUTE;
prefix.family = AF_INET;
tmpaddr.s_addr = routeEntry->ipRouteDest;
prefix.u.prefix4 = tmpaddr;
tmpaddr.s_addr = routeEntry->ipRouteMask;
prefix.prefixlen = ip_masklen(tmpaddr);
memset(&nh, 0, sizeof(nh));
nh.vrf_id = VRF_DEFAULT;
nh.type = NEXTHOP_TYPE_IPV4;
nh.gate.ipv4.s_addr = routeEntry->ipRouteNextHop;
rib_add(AFI_IP, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, 0,
zebra_flags, &prefix, NULL, &nh, 0, 0, 0, 0, 0, 0);
}
void route_read(struct zebra_ns *zns)
{
char storage[RT_BUFSIZ];
struct T_optmgmt_req *TLIreq = (struct T_optmgmt_req *)storage;
struct T_optmgmt_ack *TLIack = (struct T_optmgmt_ack *)storage;
struct T_error_ack *TLIerr = (struct T_error_ack *)storage;
struct opthdr *MIB2hdr;
mib2_ipRouteEntry_t *routeEntry, *lastRouteEntry;
struct strbuf msgdata;
int flags, dev, retval, process;
if ((dev = open(_PATH_GETMSG_ROUTE, O_RDWR)) == -1) {
flog_err_sys(EC_LIB_SYSTEM_CALL, "can't open %s: %s",
_PATH_GETMSG_ROUTE, safe_strerror(errno));
return;
}
TLIreq->PRIM_type = T_OPTMGMT_REQ;
TLIreq->OPT_offset = sizeof(struct T_optmgmt_req);
TLIreq->OPT_length = sizeof(struct opthdr);
TLIreq->MGMT_flags = T_CURRENT;
MIB2hdr = (struct opthdr *)&TLIreq[1];
MIB2hdr->level = MIB2_IP;
MIB2hdr->name = 0;
MIB2hdr->len = 0;
msgdata.buf = storage;
msgdata.len = sizeof(struct T_optmgmt_req) + sizeof(struct opthdr);
flags = 0;
if (putmsg(dev, &msgdata, NULL, flags) == -1) {
flog_err_sys(EC_LIB_SOCKET, "putmsg failed: %s",
safe_strerror(errno));
goto exit;
}
MIB2hdr = (struct opthdr *)&TLIack[1];
msgdata.maxlen = sizeof(storage);
while (1) {
flags = 0;
retval = getmsg(dev, &msgdata, NULL, &flags);
if (retval == -1) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(ctl) failed: %s",
safe_strerror(errno));
goto exit;
}
/* This is normal loop termination */
if (retval == 0
&& (size_t)msgdata.len >= sizeof(struct T_optmgmt_ack)
&& TLIack->PRIM_type == T_OPTMGMT_ACK
&& TLIack->MGMT_flags == T_SUCCESS && MIB2hdr->len == 0)
break;
if ((size_t)msgdata.len >= sizeof(struct T_error_ack)
&& TLIerr->PRIM_type == T_ERROR_ACK) {
zlog_debug("getmsg(ctl) returned T_ERROR_ACK: %s",
safe_strerror((TLIerr->TLI_error == TSYSERR)
? TLIerr->UNIX_error
: EPROTO));
break;
}
/* should dump more debugging info to the log statement,
like what GateD does in this instance, but not
critical yet. */
if (retval != MOREDATA
|| (size_t)msgdata.len < sizeof(struct T_optmgmt_ack)
|| TLIack->PRIM_type != T_OPTMGMT_ACK
|| TLIack->MGMT_flags != T_SUCCESS) {
errno = ENOMSG;
zlog_debug("getmsg(ctl) returned bizarreness");
break;
}
/* MIB2_IP_21 is the the pseudo-MIB2 ipRouteTable
entry, see <inet/mib2.h>. "This isn't the MIB data
you're looking for." */
process = (MIB2hdr->level == MIB2_IP
&& MIB2hdr->name == MIB2_IP_21)
? 1
: 0;
/* getmsg writes the data buffer out completely, not
to the closest smaller multiple. Unless reassembling
data structures across buffer boundaries is your idea
of a good time, set maxlen to the closest smaller
multiple of the size of the datastructure you're
retrieving. */
msgdata.maxlen =
sizeof(storage)
- (sizeof(storage) % sizeof(mib2_ipRouteEntry_t));
msgdata.len = 0;
flags = 0;
do {
retval = getmsg(dev, NULL, &msgdata, &flags);
if (retval == -1) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"getmsg(data) failed: %s",
safe_strerror(errno));
goto exit;
}
if (!(retval == 0 || retval == MOREDATA)) {
zlog_debug("getmsg(data) returned %d", retval);
goto exit;
}
if (process) {
if (msgdata.len % sizeof(mib2_ipRouteEntry_t)
!= 0) {
zlog_debug(
"getmsg(data) returned msgdata.len = %d (%% sizeof(mib2_ipRouteEntry_t) != 0)",
msgdata.len);
goto exit;
}
routeEntry = (mib2_ipRouteEntry_t *)msgdata.buf;
lastRouteEntry =
(mib2_ipRouteEntry_t *)(msgdata.buf
+ msgdata.len);
do {
handle_route_entry(routeEntry);
} while (++routeEntry < lastRouteEntry);
}
} while (retval == MOREDATA);
}
exit:
close(dev);
}
/* Only implemented for netlink method */
void macfdb_read(struct zebra_ns *zns)
{
}
void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp,
struct interface *br_if)
{
}
void macfdb_read_specific_mac(struct zebra_ns *zns, struct interface *br_if,
struct ethaddr *mac, vlanid_t vid)
{
}
void neigh_read(struct zebra_ns *zns)
{
}
void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if)
{
}
void neigh_read_specific_ip(struct ipaddr *ip, struct interface *vlan_if)
{
}
void kernel_read_pbr_rules(struct zebra_ns *zns)
{
}
#endif /* SUNOS_5 */

View file

@ -21,7 +21,7 @@
#include <zebra.h> #include <zebra.h>
#if !defined(GNU_LINUX) && !defined(SUNOS_5) #if !defined(GNU_LINUX)
#include "memory.h" #include "memory.h"
#include "zebra_memory.h" #include "zebra_memory.h"
@ -109,4 +109,4 @@ void kernel_read_pbr_rules(struct zebra_ns *zns)
{ {
} }
#endif /* !defined(GNU_LINUX) && !defined(SUNOS_5) */ #endif /* !defined(GNU_LINUX) */

View file

@ -51,14 +51,11 @@ zebra_zebra_SOURCES = \
zebra/connected.c \ zebra/connected.c \
zebra/debug.c \ zebra/debug.c \
zebra/if_ioctl.c \ zebra/if_ioctl.c \
zebra/if_ioctl_solaris.c \
zebra/if_netlink.c \ zebra/if_netlink.c \
zebra/if_sysctl.c \ zebra/if_sysctl.c \
zebra/interface.c \ zebra/interface.c \
zebra/ioctl.c \ zebra/ioctl.c \
zebra/ioctl_solaris.c \
zebra/ipforward_proc.c \ zebra/ipforward_proc.c \
zebra/ipforward_solaris.c \
zebra/ipforward_sysctl.c \ zebra/ipforward_sysctl.c \
zebra/kernel_netlink.c \ zebra/kernel_netlink.c \
zebra/kernel_socket.c \ zebra/kernel_socket.c \
@ -69,7 +66,6 @@ zebra_zebra_SOURCES = \
zebra/rt_netlink.c \ zebra/rt_netlink.c \
zebra/rt_socket.c \ zebra/rt_socket.c \
zebra/rtadv.c \ zebra/rtadv.c \
zebra/rtread_getmsg.c \
zebra/rtread_netlink.c \ zebra/rtread_netlink.c \
zebra/rtread_sysctl.c \ zebra/rtread_sysctl.c \
zebra/rule_netlink.c \ zebra/rule_netlink.c \
@ -133,7 +129,6 @@ noinst_HEADERS += \
zebra/if_netlink.h \ zebra/if_netlink.h \
zebra/interface.h \ zebra/interface.h \
zebra/ioctl.h \ zebra/ioctl.h \
zebra/ioctl_solaris.h \
zebra/ipforward.h \ zebra/ipforward.h \
zebra/irdp.h \ zebra/irdp.h \
zebra/kernel_netlink.h \ zebra/kernel_netlink.h \

View file

@ -40,11 +40,7 @@
/* routing table identifiers /* routing table identifiers
* *
*/ */
#ifdef SUNOS_5 #if !defined(GNU_LINUX)
/* SunOS
*/
#else
#if !defined(GNU_LINUX) && !defined(SUNOS_5)
/* BSD systems /* BSD systems
*/ */
#else #else
@ -55,8 +51,7 @@
#define RT_TABLE_ID_DEFAULT 253 #define RT_TABLE_ID_DEFAULT 253
#define RT_TABLE_ID_COMPAT 252 #define RT_TABLE_ID_COMPAT 252
#define RT_TABLE_ID_UNSPEC 0 #define RT_TABLE_ID_UNSPEC 0
#endif /* !def(GNU_LINUX) && !defined(SUNOS_5) */ #endif /* !def(GNU_LINUX) */
#endif /* SUNOS_5 */
#define RT_TABLE_ID_UNRESERVED_MIN 1 #define RT_TABLE_ID_UNRESERVED_MIN 1
#define RT_TABLE_ID_UNRESERVED_MAX 0xffffffff #define RT_TABLE_ID_UNRESERVED_MAX 0xffffffff
@ -126,11 +121,7 @@ struct table_manager_chunk *assign_table_chunk(uint8_t proto, uint16_t instance,
start = ((struct table_manager_chunk *)listgetdata( start = ((struct table_manager_chunk *)listgetdata(
listtail(tbl_mgr.lc_list)))->end + 1; listtail(tbl_mgr.lc_list)))->end + 1;
#ifdef SUNOS_5 #if !defined(GNU_LINUX)
/* SunOS
*/
#else
#if !defined(GNU_LINUX) && !defined(SUNOS_5)
/* BSD systems /* BSD systems
*/ */
#else #else
@ -143,8 +134,7 @@ struct table_manager_chunk *assign_table_chunk(uint8_t proto, uint16_t instance,
RT_TABLE_ID_COMPAT RT_TABLE_ID_COMPAT
- RT_TABLE_ID_UNRESERVED_MIN)) - RT_TABLE_ID_UNRESERVED_MIN))
start = RT_TABLE_ID_LOCAL + 1; start = RT_TABLE_ID_LOCAL + 1;
#endif /* !def(GNU_LINUX) && !defined(SUNOS_5) */ #endif /* !def(GNU_LINUX) */
#endif /* SUNOS_5 */
tmc->start = start; tmc->start = start;
if (RT_TABLE_ID_UNRESERVED_MAX - size + 1 < start) { if (RT_TABLE_ID_UNRESERVED_MAX - size + 1 < start) {
flog_err(EC_ZEBRA_TM_EXHAUSTED_IDS, flog_err(EC_ZEBRA_TM_EXHAUSTED_IDS,