mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fix build against Debian version of libhttp-parser -- its old but it will work.
This commit is contained in:
parent
0ca764968a
commit
4da9d4e53a
7 changed files with 45 additions and 4 deletions
4
debian/control
vendored
4
debian/control
vendored
|
@ -3,14 +3,14 @@ Maintainer: Adam Ierymenko <adam.ierymenko@zerotier.com>
|
||||||
Section: net
|
Section: net
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Build-Depends: debhelper (>= 9), nodejs (>= 0.10.0), libhttp-parser-dev (>= 2.1), liblz4-dev, npm (>= 1.4.0), libnatpmp-dev
|
Build-Depends: debhelper (>= 9), nodejs (>= 0.10.0), libhttp-parser-dev (>= 2.1), liblz4-dev, npm (>= 1.4.0), libnatpmp-dev, dh-systemd
|
||||||
Vcs-Git: git://github.com/zerotier/ZeroTierOne
|
Vcs-Git: git://github.com/zerotier/ZeroTierOne
|
||||||
Vcs-Browser: https://github.com/zerotier/ZeroTierOne
|
Vcs-Browser: https://github.com/zerotier/ZeroTierOne
|
||||||
Homepage: https://www.zerotier.com/
|
Homepage: https://www.zerotier.com/
|
||||||
|
|
||||||
Package: zerotier-one
|
Package: zerotier-one
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, libhttp-parser2.1, liblz4-1, libnatpmp1
|
Depends: ${shlibs:Depends}, ${misc:Depends}, libhttp-parser2.1, liblz4-1, libnatpmp1
|
||||||
Homepage: https://www.zerotier.com/
|
Homepage: https://www.zerotier.com/
|
||||||
Description: ZeroTier network virtualization service
|
Description: ZeroTier network virtualization service
|
||||||
ZeroTier One lets you join ZeroTier virtual networks and
|
ZeroTier One lets you join ZeroTier virtual networks and
|
||||||
|
|
5
debian/rules
vendored
5
debian/rules
vendored
|
@ -4,7 +4,10 @@ CFLAGS=-O3 -fstack-protector-strong
|
||||||
CXXFLAGS=-O3 -fstack-protector-strong
|
CXXFLAGS=-O3 -fstack-protector-strong
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@
|
dh $@ --with systemd
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
make ZT_USE_MINIUPNPC=1 -j 2
|
make ZT_USE_MINIUPNPC=1 -j 2
|
||||||
|
|
||||||
|
override_dh_systemd_start:
|
||||||
|
dh_systemd_start --restart-after-upgrade
|
||||||
|
|
|
@ -3,7 +3,7 @@ Description=ZeroTier One
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/var/lib/zerotier-one/zerotier-one
|
ExecStart=/usr/sbin/zerotier-one
|
||||||
Restart=always
|
Restart=always
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ ifeq ($(wildcard /usr/include/http_parser.h),)
|
||||||
OBJS+=ext/http-parser/http_parser.o
|
OBJS+=ext/http-parser/http_parser.o
|
||||||
else
|
else
|
||||||
LDLIBS+=-lhttp_parser
|
LDLIBS+=-lhttp_parser
|
||||||
|
DEFS+=-DZT_USE_SYSTEM_HTTP_PARSER
|
||||||
endif
|
endif
|
||||||
ifeq ($(wildcard /usr/include/json-parser/json.h),)
|
ifeq ($(wildcard /usr/include/json-parser/json.h),)
|
||||||
OBJS+=ext/json-parser/json.o
|
OBJS+=ext/json-parser/json.o
|
||||||
|
@ -177,6 +178,9 @@ install: FORCE
|
||||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||||
cat doc/zerotier-cli.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
cat doc/zerotier-cli.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||||
cat doc/zerotier-idtool.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
cat doc/zerotier-idtool.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
||||||
|
mkdir -p $(DESTDIR)/usr/lib/systemd/system
|
||||||
|
rm -f $(DESTDIR)/usr/lib/systemd/system/zerotier-one.service
|
||||||
|
cp -f ext/installfiles/linux/systemd/zerotier-one.service $(DESTDIR)/usr/lib/systemd/system
|
||||||
|
|
||||||
uninstall: FORCE
|
uninstall: FORCE
|
||||||
rm -f $(DESTDIR)/var/lib/zerotier-one/zerotier-one
|
rm -f $(DESTDIR)/var/lib/zerotier-one/zerotier-one
|
||||||
|
@ -192,6 +196,7 @@ uninstall: FORCE
|
||||||
rm -f $(DESTDIR)/usr/share/man/man8/zerotier-one.8.gz
|
rm -f $(DESTDIR)/usr/share/man/man8/zerotier-one.8.gz
|
||||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
||||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||||
|
rm -f $(DESTDIR)/usr/lib/systemd/system/zerotier-one.service
|
||||||
|
|
||||||
debian: distclean
|
debian: distclean
|
||||||
debuild -I -i -us -uc
|
debuild -I -i -us -uc
|
||||||
|
|
|
@ -25,7 +25,12 @@
|
||||||
#include "OSUtils.hpp"
|
#include "OSUtils.hpp"
|
||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Utils.hpp"
|
#include "../node/Utils.hpp"
|
||||||
|
|
||||||
|
#ifdef ZT_USE_SYSTEM_HTTP_PARSER
|
||||||
|
#include <http_parser.h>
|
||||||
|
#else
|
||||||
#include "../ext/http-parser/http_parser.h"
|
#include "../ext/http-parser/http_parser.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
@ -33,7 +38,11 @@ namespace {
|
||||||
|
|
||||||
static int ShttpOnMessageBegin(http_parser *parser);
|
static int ShttpOnMessageBegin(http_parser *parser);
|
||||||
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length);
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length);
|
||||||
|
#else
|
||||||
|
static int ShttpOnStatus(http_parser *parser);
|
||||||
|
#endif
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnHeadersComplete(http_parser *parser);
|
static int ShttpOnHeadersComplete(http_parser *parser);
|
||||||
|
@ -126,12 +135,18 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
|
#else
|
||||||
|
static int ShttpOnStatus(http_parser *parser)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
||||||
hh->messageSize += (unsigned long)length;
|
hh->messageSize += (unsigned long)length;
|
||||||
if (hh->messageSize > hh->maxResponseSize)
|
if (hh->messageSize > hh->maxResponseSize)
|
||||||
return -1;
|
return -1;
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "../include/ZeroTierOne.h"
|
#include "../include/ZeroTierOne.h"
|
||||||
|
|
||||||
|
#ifdef ZT_USE_SYSTEM_HTTP_PARSER
|
||||||
|
#include <http_parser.h>
|
||||||
|
#else
|
||||||
#include "../ext/http-parser/http_parser.h"
|
#include "../ext/http-parser/http_parser.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
|
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
|
||||||
#include "../controller/SqliteNetworkController.hpp"
|
#include "../controller/SqliteNetworkController.hpp"
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "../include/ZeroTierOne.h"
|
#include "../include/ZeroTierOne.h"
|
||||||
|
|
||||||
|
#ifdef ZT_USE_SYSTEM_HTTP_PARSER
|
||||||
|
#include <http_parser.h>
|
||||||
|
#else
|
||||||
#include "../ext/http-parser/http_parser.h"
|
#include "../ext/http-parser/http_parser.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Mutex.hpp"
|
#include "../node/Mutex.hpp"
|
||||||
|
@ -402,7 +406,11 @@ static void StapFrameHandler(void *uptr,uint64_t nwid,const MAC &from,const MAC
|
||||||
|
|
||||||
static int ShttpOnMessageBegin(http_parser *parser);
|
static int ShttpOnMessageBegin(http_parser *parser);
|
||||||
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length);
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length);
|
||||||
|
#else
|
||||||
|
static int ShttpOnStatus(http_parser *parser);
|
||||||
|
#endif
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnHeadersComplete(http_parser *parser);
|
static int ShttpOnHeadersComplete(http_parser *parser);
|
||||||
|
@ -1621,13 +1629,19 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
||||||
tc->url.append(ptr,length);
|
tc->url.append(ptr,length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
|
#else
|
||||||
|
static int ShttpOnStatus(http_parser *parser)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
TcpConnection *tc = reinterpret_cast<TcpConnection *>(parser->data);
|
TcpConnection *tc = reinterpret_cast<TcpConnection *>(parser->data);
|
||||||
tc->messageSize += (unsigned long)length;
|
tc->messageSize += (unsigned long)length;
|
||||||
if (tc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (tc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
tc->status.append(ptr,length);
|
tc->status.append(ptr,length);
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
|
|
Loading…
Add table
Reference in a new issue