mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-26 17:03:43 +02:00
Merge branch 'dev' into edge
This commit is contained in:
commit
1ab29b1ab0
2 changed files with 14 additions and 8 deletions
|
@ -57,7 +57,7 @@ LinuxNetLink::LinuxNetLink()
|
|||
_setSocketTimeout(_fd, 1);
|
||||
|
||||
_la.nl_family = AF_NETLINK;
|
||||
_la.nl_pid = getpid()+1;
|
||||
_la.nl_pid = 0; //getpid()+1;
|
||||
_la.nl_groups = RTMGRP_LINK|RTMGRP_IPV4_IFADDR|RTMGRP_IPV6_IFADDR|RTMGRP_IPV4_ROUTE|RTMGRP_IPV6_ROUTE|RTMGRP_NOTIFY;
|
||||
if (bind(_fd, (struct sockaddr*)&_la, sizeof(_la))) {
|
||||
fprintf(stderr, "Error connecting to RTNETLINK: %s\n", strerror(errno));
|
||||
|
@ -437,7 +437,7 @@ void LinuxNetLink::_requestIPv4Routes()
|
|||
|
||||
struct sockaddr_nl la;
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
la.nl_groups = RTMGRP_IPV4_ROUTE;
|
||||
if(bind(fd, (struct sockaddr*)&la, sizeof(la))) {
|
||||
fprintf(stderr, "Error binding RTNETLINK (_requiestIPv4Routes #1): %s\n", strerror(errno));
|
||||
|
@ -490,7 +490,7 @@ void LinuxNetLink::_requestIPv6Routes()
|
|||
|
||||
struct sockaddr_nl la;
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
la.nl_groups = RTMGRP_IPV6_ROUTE;
|
||||
if(bind(fd, (struct sockaddr*)&la, sizeof(struct sockaddr_nl))) {
|
||||
fprintf(stderr, "Error binding RTNETLINK (_requestIPv6Routes #1): %s\n", strerror(errno));
|
||||
|
@ -543,7 +543,7 @@ void LinuxNetLink::_requestInterfaceList()
|
|||
|
||||
struct sockaddr_nl la;
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
la.nl_groups = RTMGRP_LINK;
|
||||
if(bind(fd, (struct sockaddr*)&la, sizeof(struct sockaddr_nl))) {
|
||||
fprintf(stderr, "Error binding RTNETLINK (_requestInterfaceList #1): %s\n", strerror(errno));
|
||||
|
@ -597,7 +597,7 @@ void LinuxNetLink::addRoute(const InetAddress &target, const InetAddress &via, c
|
|||
struct sockaddr_nl la;
|
||||
bzero(&la, sizeof(la));
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
|
||||
if(bind(fd, (struct sockaddr*)&la, sizeof(struct sockaddr_nl))) {
|
||||
fprintf(stderr, "Error binding RTNETLINK (addRoute #1): %s\n", strerror(errno));
|
||||
|
@ -712,7 +712,7 @@ void LinuxNetLink::delRoute(const InetAddress &target, const InetAddress &via, c
|
|||
|
||||
struct sockaddr_nl la;
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
|
||||
if(bind(fd, (struct sockaddr*)&la, sizeof(struct sockaddr_nl))) {
|
||||
fprintf(stderr, "Error binding RTNETLINK (delRoute #1): %s\n", strerror(errno));
|
||||
|
@ -826,7 +826,7 @@ void LinuxNetLink::addAddress(const InetAddress &addr, const char *iface)
|
|||
struct sockaddr_nl la;
|
||||
memset(&la,0,sizeof(la));
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
if (addr.isV4()) {
|
||||
la.nl_groups = RTMGRP_IPV4_IFADDR;
|
||||
} else {
|
||||
|
@ -943,7 +943,7 @@ void LinuxNetLink::removeAddress(const InetAddress &addr, const char *iface)
|
|||
|
||||
struct sockaddr_nl la;
|
||||
la.nl_family = AF_NETLINK;
|
||||
la.nl_pid = getpid();
|
||||
la.nl_pid = 0; //getpid();
|
||||
if (addr.isV4()) {
|
||||
la.nl_groups = RTMGRP_IPV4_IFADDR;
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#ifndef ZT_LINUX_NETLINK_HPP
|
||||
#define ZT_LINUX_NETLINK_HPP
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
#ifdef __LINUX__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
@ -113,4 +117,6 @@ private:
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ZT_LINUX_NETLINK_HPPS
|
Loading…
Add table
Reference in a new issue