mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-24 02:51:14 +00:00
Build fixes
This commit is contained in:
parent
b0d222768a
commit
f680924585
@ -723,7 +723,7 @@ extern "C" int ZT_GoTap_removeRoute(ZT_GoTap *tap,int targetAf,const void *targe
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ZT_GoLocator_makeSecureDNSName(char *name,unsigned int nameBufSize,uint8_t *privateKey,unsigned int privateKeyBufSize)
|
||||
extern "C" int ZT_GoLocator_makeSecureDNSName(char *name,unsigned int nameBufSize,uint8_t *privateKey,unsigned int privateKeyBufSize)
|
||||
{
|
||||
if ((privateKeyBufSize < ZT_ECC384_PRIVATE_KEY_SIZE)||(nameBufSize < 256))
|
||||
return -1;
|
||||
@ -736,7 +736,7 @@ int ZT_GoLocator_makeSecureDNSName(char *name,unsigned int nameBufSize,uint8_t *
|
||||
return ZT_ECC384_PRIVATE_KEY_SIZE;
|
||||
}
|
||||
|
||||
int ZT_GoLocator_makeLocator(
|
||||
extern "C" int ZT_GoLocator_makeLocator(
|
||||
uint8_t *buf,
|
||||
unsigned int bufSize,
|
||||
int64_t ts,
|
||||
@ -775,7 +775,7 @@ int ZT_GoLocator_makeLocator(
|
||||
return s;
|
||||
}
|
||||
|
||||
int ZT_GoLocator_decodeLocator(const uint8_t *locatorBytes,unsigned int locatorSize,struct ZT_GoLocator_Info *info)
|
||||
extern "C" int ZT_GoLocator_decodeLocator(const uint8_t *locatorBytes,unsigned int locatorSize,struct ZT_GoLocator_Info *info)
|
||||
{
|
||||
Locator loc;
|
||||
if (!loc.deserialize(locatorBytes,locatorSize))
|
||||
|
@ -114,6 +114,7 @@ int ZT_GoLocator_makeSecureDNSName(char name[256],unsigned int nameBufSize,uint8
|
||||
int ZT_GoLocator_makeLocator(
|
||||
uint8_t *buf,
|
||||
unsigned int bufSize,
|
||||
int64_t ts,
|
||||
const char *id,
|
||||
const struct sockaddr_storage *physicalAddresses,
|
||||
unsigned int physicalAddressCount,
|
||||
|
@ -90,14 +90,14 @@ func NewLocator(id *Identity, virtualAddresses []*Identity, physicalAddresses []
|
||||
|
||||
var buf [65536]byte
|
||||
var pPhy *C.struct_sockaddr_storage
|
||||
var pVirt *C.char
|
||||
var pVirt **C.char
|
||||
if len(phy) > 0 {
|
||||
pPhy = &phy[0]
|
||||
}
|
||||
if len(virt) > 0 {
|
||||
pVirt = &virt[0]
|
||||
}
|
||||
locSize := C.ZT_GoLocator_makeLocator((*C.uint8_t)(unsafe.Pointer(&buf[0])), 65536, idCstr, pPhy, C.uint(len(phy)), pVirt, C.uint(len(virt)))
|
||||
locSize := C.ZT_GoLocator_makeLocator((*C.uint8_t)(unsafe.Pointer(&buf[0])), 65536, C.int64_t(TimeMs()), idCstr, pPhy, C.uint(len(phy)), pVirt, C.uint(len(virt)))
|
||||
if locSize <= 0 {
|
||||
return nil, ErrInvalidParameter
|
||||
}
|
||||
@ -128,7 +128,7 @@ func NewLocatorFromBytes(b []byte) (*Locator, error) {
|
||||
var loc Locator
|
||||
|
||||
var err error
|
||||
loc.Identity, err = NewIdentityFromString(C.GoString(info.id))
|
||||
loc.Identity, err = NewIdentityFromString(C.GoString(&info.id[0]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -139,7 +139,7 @@ func NewLocatorFromBytes(b []byte) (*Locator, error) {
|
||||
}
|
||||
}
|
||||
for i := 0; i < int(info.virtCount); i++ {
|
||||
id, err := NewIdentityFromString(C.GoString(info.virt[i]))
|
||||
id, err := NewIdentityFromString(C.GoString(&info.virt[i][0]))
|
||||
if err == nil {
|
||||
loc.Virtual = append(loc.Virtual, id)
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ func (n *Network) LocalSettings() NetworkLocalSettings {
|
||||
|
||||
// MulticastSubscribe subscribes to a multicast group
|
||||
func (n *Network) MulticastSubscribe(mg *MulticastGroup) {
|
||||
n.node.log.Printf("%.16x joined multicast group %s", mg.String())
|
||||
n.node.log.Printf("%.16x joined multicast group %s", uint64(n.id), mg.String())
|
||||
k := mg.key()
|
||||
n.multicastSubscriptionsLock.Lock()
|
||||
if _, have := n.multicastSubscriptions[k]; have {
|
||||
@ -217,7 +217,7 @@ func (n *Network) MulticastSubscribe(mg *MulticastGroup) {
|
||||
|
||||
// MulticastUnsubscribe removes a subscription to a multicast group
|
||||
func (n *Network) MulticastUnsubscribe(mg *MulticastGroup) {
|
||||
n.node.log.Printf("%.16x left multicast group %s", mg.String())
|
||||
n.node.log.Printf("%.16x left multicast group %s", uint64(n.id), mg.String())
|
||||
n.multicastSubscriptionsLock.Lock()
|
||||
delete(n.multicastSubscriptions, mg.key())
|
||||
n.multicastSubscriptionsLock.Unlock()
|
||||
@ -311,7 +311,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
||||
k := ipNetToKey(&ip)
|
||||
wantAssignedIPs[k] = true
|
||||
if _, have := haveAssignedIPs[k]; !have {
|
||||
n.node.log.Printf("%.16x adding managed IP %s", n.ID, ip.String())
|
||||
n.node.log.Printf("%.16x adding managed IP %s", uint64(n.id), ip.String())
|
||||
n.tap.AddIP(&ip)
|
||||
}
|
||||
}
|
||||
@ -319,7 +319,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
||||
}
|
||||
for k, ip := range haveAssignedIPs {
|
||||
if _, want := wantAssignedIPs[k]; !want {
|
||||
n.node.log.Printf("%.16x removing managed IP %s", n.ID, ip.String())
|
||||
n.node.log.Printf("%.16x removing managed IP %s", uint64(n.id), ip.String())
|
||||
n.tap.RemoveIP(ip)
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
||||
k := r.key()
|
||||
wantManagedRoutes[k] = true
|
||||
if _, have := haveManagedRoutes[k]; !have {
|
||||
n.node.log.Printf("%.16x adding managed route %s", n.ID, r.String())
|
||||
n.node.log.Printf("%.16x adding managed route %s", uint64(n.id), r.String())
|
||||
n.tap.AddRoute(&r)
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
||||
}
|
||||
for k, r := range haveManagedRoutes {
|
||||
if _, want := wantManagedRoutes[k]; !want {
|
||||
n.node.log.Printf("%.16x removing managed route %s", n.ID, r.String())
|
||||
n.node.log.Printf("%.16x removing managed route %s", uint64(n.id), r.String())
|
||||
n.tap.RemoveRoute(r)
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ func (n *Node) Join(nwid NetworkID, settings *NetworkLocalSettings, tap Tap) (*N
|
||||
}
|
||||
ntap := C.ZT_GoNode_join(n.gn, C.uint64_t(nwid))
|
||||
if ntap == nil {
|
||||
n.log.Printf("join network %.16x failed: tap device failed to initialize (check drivers / kernel modules)")
|
||||
n.log.Printf("join network %.16x failed: tap device failed to initialize (check drivers / kernel modules)", uint64(nwid))
|
||||
return nil, ErrTapInitFailed
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ func (n *Node) Roots() []*Root {
|
||||
}
|
||||
}
|
||||
roots = append(roots, &Root{
|
||||
Name: C.GoString(root.dnsName),
|
||||
Name: C.GoString(root.name),
|
||||
Identity: id,
|
||||
Addresses: addrs,
|
||||
Preferred: (root.preferred != 0),
|
||||
@ -592,7 +592,7 @@ func (n *Node) SetRoot(name string, locator *Locator) error {
|
||||
}
|
||||
cn := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cn))
|
||||
if C.ZT_Node_setRoot(n.zn, cn, lbp, C.uint(len(lb))) != 0 {
|
||||
if C.ZT_Node_setRoot(unsafe.Pointer(n.zn), cn, lbp, C.uint(len(lb))) != 0 {
|
||||
return ErrInternal
|
||||
}
|
||||
return nil
|
||||
@ -603,7 +603,7 @@ func (n *Node) SetRoot(name string, locator *Locator) error {
|
||||
func (n *Node) RemoveRoot(name string) {
|
||||
cn := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cn))
|
||||
C.ZT_Node_removeRoot(n.zn, cn)
|
||||
C.ZT_Node_removeRoot(unsafe.Pointer(n.zn), cn)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user