Solaris 11 compilation fixes
This commit is contained in:
parent
81d348207c
commit
77968a09d9
|
@ -42,8 +42,8 @@ get_src_for_route_to(const struct sockaddr * dst,
|
|||
|
||||
if(dst == NULL)
|
||||
return -1;
|
||||
if(dst->sa_len > 0) {
|
||||
l = dst->sa_len;
|
||||
if(SA_LEN(dst) > 0) {
|
||||
l = SA_LEN(dst);
|
||||
} else {
|
||||
if(dst->sa_family == AF_INET)
|
||||
l = sizeof(struct sockaddr_in);
|
||||
|
@ -66,7 +66,9 @@ get_src_for_route_to(const struct sockaddr * dst,
|
|||
rtm.rtm_seq = 1;
|
||||
rtm.rtm_addrs = RTA_DST | RTA_IFA | RTA_IFP; /* pass destination address, request source address & interface */
|
||||
memcpy(m_rtmsg.m_space, dst, l);
|
||||
#if !defined(__sun)
|
||||
((struct sockaddr *)m_rtmsg.m_space)->sa_len = l;
|
||||
#endif
|
||||
rtm.rtm_msglen = sizeof(struct rt_msghdr) + l;
|
||||
if(write(s, &m_rtmsg, rtm.rtm_msglen) < 0) {
|
||||
syslog(LOG_ERR, "write: %m");
|
||||
|
@ -101,7 +103,7 @@ get_src_for_route_to(const struct sockaddr * dst,
|
|||
sa = (struct sockaddr *)p;
|
||||
sockaddr_to_string(sa, tmp, sizeof(tmp));
|
||||
syslog(LOG_DEBUG, "type=%d sa_len=%d sa_family=%d %s",
|
||||
i, sa->sa_len, sa->sa_family, tmp);
|
||||
i, SA_LEN(sa), sa->sa_family, tmp);
|
||||
if(i == RTA_IFA) {
|
||||
size_t len = 0;
|
||||
void * paddr = NULL;
|
||||
|
|
|
@ -66,6 +66,7 @@ struct file;
|
|||
#include "netinet/ip_nat.h"
|
||||
#include "netinet/ip_state.h"
|
||||
|
||||
#include "../macros.h"
|
||||
|
||||
#ifndef __P
|
||||
# ifdef __STDC__
|
||||
|
@ -330,6 +331,7 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto,
|
|||
ipfobj_t obj;
|
||||
ipnat_t ipn;
|
||||
int r;
|
||||
UNUSED(ifname);
|
||||
|
||||
memset(&obj, 0, sizeof(obj));
|
||||
obj.ipfo_rev = IPFILTER_VERSION;
|
||||
|
@ -490,6 +492,7 @@ real_delete_redirect_rule(const char * ifname, unsigned short eport, int proto)
|
|||
ipfobj_t obj;
|
||||
ipnat_t ipn;
|
||||
int r;
|
||||
UNUSED(ifname);
|
||||
|
||||
memset(&obj, 0, sizeof(obj));
|
||||
obj.ipfo_rev = IPFILTER_VERSION;
|
||||
|
@ -566,6 +569,8 @@ add_filter_rule2(const char * ifname, const char * rhost,
|
|||
frentry_t fr;
|
||||
fripf_t ipffr;
|
||||
int r;
|
||||
UNUSED(ifname); UNUSED(desc);
|
||||
UNUSED(iport);
|
||||
|
||||
if (dev_ipl < 0) {
|
||||
syslog(LOG_ERR, "%s not open", IPL_NAME);
|
||||
|
@ -655,6 +660,7 @@ delete_filter_rule(const char * ifname, unsigned short eport, int proto)
|
|||
friostat_t fio;
|
||||
frentry_t *fp;
|
||||
int r;
|
||||
UNUSED(ifname);
|
||||
|
||||
if (dev_ipl < 0) {
|
||||
syslog(LOG_ERR, "%s not open", IPL_NAME);
|
||||
|
@ -804,6 +810,8 @@ update_portmapping(const char * ifname, unsigned short eport, int proto,
|
|||
unsigned short iport, const char * desc,
|
||||
unsigned int timestamp)
|
||||
{
|
||||
UNUSED(ifname); UNUSED(eport); UNUSED(proto);
|
||||
UNUSED(iport); UNUSED(desc); UNUSED(timestamp);
|
||||
/* TODO: implement update_portmapping() */
|
||||
syslog(LOG_ERR, __FILE__ " update_portmapping() is not implemented");
|
||||
return -1;
|
||||
|
@ -815,6 +823,7 @@ update_portmapping_desc_timestamp(const char * ifname,
|
|||
unsigned short eport, int proto,
|
||||
const char * desc, unsigned int timestamp)
|
||||
{
|
||||
UNUSED(ifname);
|
||||
del_redirect_desc(eport, proto);
|
||||
add_redirect_desc(eport,proto, timestamp, desc);
|
||||
return 0;
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE static inline
|
||||
#endif
|
||||
/* theses macros are designed to read/write unsigned short/long int
|
||||
* from an unsigned char array in network order (big endian).
|
||||
* Avoid pointer casting, so avoid accessing unaligned memory, which
|
||||
|
|
|
@ -22,8 +22,6 @@ getifstats(const char * ifname, struct ifdata * data)
|
|||
kstat_ctl_t *kc;
|
||||
int instance;
|
||||
kstat_t *ksp;
|
||||
uint32_t cnt32;
|
||||
void *ptr;
|
||||
|
||||
if (data == NULL)
|
||||
goto error;
|
||||
|
@ -46,7 +44,6 @@ getifstats(const char * ifname, struct ifdata * data)
|
|||
if (ksp && (kstat_read(kc, ksp, NULL) != -1)) {
|
||||
/* found the right interface */
|
||||
if (sizeof(long) == 8) {
|
||||
uint64_t cnt64;
|
||||
kn = kstat_data_lookup(ksp, "rbytes64");
|
||||
if (kn != NULL) {
|
||||
data->ibytes = kn->value.i64;
|
||||
|
|
|
@ -34,7 +34,7 @@ get_lan_for_peer(const struct sockaddr * peer);
|
|||
* define portability macros
|
||||
*/
|
||||
#if defined(__sun)
|
||||
static size_t _sa_len(const struct sockaddr *addr)
|
||||
static __inline size_t _sa_len(const struct sockaddr *addr)
|
||||
{
|
||||
if (addr->sa_family == AF_INET)
|
||||
return (sizeof(struct sockaddr_in));
|
||||
|
|
Loading…
Reference in New Issue