Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/basic/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ json_parse_number(const char **p, union json_value *ret)

if (is_double) {
ret->real = ((negative ? -1.0 : 1.0) * (x + (y / shift))) *
exp10((exponent_negative ? -1.0 : 1.0) * exponent);
pow((exponent_negative ? -1.0 : 1.0) * exponent, 10.0);
return JSON_REAL;
} else {
ret->integer = negative ? -i : i;
Expand Down
16 changes: 12 additions & 4 deletions lib/basic/socket-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ socket_address_print(const SocketAddress *a, char **ret)
if (r < 0)
return r;

#ifdef AF_NETLINK
#ifdef SVC_PLATFORM_Linux
if (socket_address_family(a) == AF_NETLINK) {
_cleanup_free_ char *sfamily = NULL;

Expand Down Expand Up @@ -403,7 +403,7 @@ socket_address_equal(const SocketAddress *a, const SocketAddress *b)

break;

#ifdef AF_NETLINK
#ifdef SVC_PLATFORM_Linux
case AF_NETLINK:
if (a->protocol != b->protocol)
return false;
Expand Down Expand Up @@ -441,7 +441,7 @@ socket_address_is(const SocketAddress *a, const char *s, int type)
bool
socket_address_is_netlink(const SocketAddress *a, const char *s)
{
#ifdef AF_NETLINK
#ifdef SVC_PLATFORM_Linux
struct SocketAddress b;

assert(a);
Expand Down Expand Up @@ -779,10 +779,12 @@ socket_address_unlink(SocketAddress *a)
}

#ifdef AF_NETLINK
static const char *const netlink_family_table[] = {
static const char *const netlink_family_table[32] = {
[NETLINK_ROUTE] = "route",
[NETLINK_FIREWALL] = "firewall",
#ifdef NETLINK_INET_DIAG
[NETLINK_INET_DIAG] = "inet-diag",
#endif
[NETLINK_NFLOG] = "nflog",
[NETLINK_XFRM] = "xfrm",
[NETLINK_SELINUX] = "selinux",
Expand All @@ -795,9 +797,15 @@ static const char *const netlink_family_table[] = {
[NETLINK_DNRTMSG] = "dnrtmsg",
[NETLINK_KOBJECT_UEVENT] = "kobject-uevent",
[NETLINK_GENERIC] = "generic",
#ifdef NETLINK_SCSITRANSPORT
[NETLINK_SCSITRANSPORT] = "scsitransport",
#endif
#ifdef NETLINK_ECRYPTFS
[NETLINK_ECRYPTFS] = "ecryptfs",
#endif
#ifdef NETLINK_RDMA
[NETLINK_RDMA] = "rdma",
#endif
};

DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(netlink_family, int, INT_MAX);
Expand Down
4 changes: 3 additions & 1 deletion lib/basic/socket-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
#include "macro.h"
#include "util.h"

#ifdef SVC_PLATFORM_Linux
#if defined(SVC_PLATFORM_Linux)
#include <asm/types.h>
#include <linux/if_packet.h>
#include <linux/netlink.h>
#include <netinet/ether.h>
#elif defined(SVC_PLATFORM_FreeBSD)
#include <netlink/netlink.h>
#endif

#if defined(SVC_PLATFORM_Linux)
Expand Down