Skip to content

Commit 174b12a

Browse files
authored
Merge pull request #40 from caleb2h/br_sign_index_message
Crypto sign index communication
2 parents d0fbd85 + f24d706 commit 174b12a

14 files changed

+1960
-186
lines changed

Makefile.inc

Lines changed: 104 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,84 @@
1-
MINIUPNP_OBJS = \
2-
./libs/miniupnpc/miniwget.o \
3-
./libs/miniupnpc/minixml.o \
4-
./libs/miniupnpc/igd_desc_parse.o \
5-
./libs/miniupnpc/minisoap.o \
6-
./libs/miniupnpc/miniupnpc.o \
7-
./libs/miniupnpc/upnpreplyparse.o \
8-
./libs/miniupnpc/upnpcommands.o \
9-
./libs/miniupnpc/upnperrors.o \
10-
./libs/miniupnpc/connecthostport.o \
11-
./libs/miniupnpc/portlistingparse.o \
12-
./libs/miniupnpc/receivedata.o \
13-
./libs/miniupnpc/upnpdev.o \
1+
MINIUPNP_OBJS = \
2+
./libs/miniupnpc/miniwget.o \
3+
./libs/miniupnpc/minixml.o \
4+
./libs/miniupnpc/igd_desc_parse.o \
5+
./libs/miniupnpc/minisoap.o \
6+
./libs/miniupnpc/miniupnpc.o \
7+
./libs/miniupnpc/upnpreplyparse.o \
8+
./libs/miniupnpc/upnpcommands.o \
9+
./libs/miniupnpc/upnperrors.o \
10+
./libs/miniupnpc/connecthostport.o \
11+
./libs/miniupnpc/portlistingparse.o \
12+
./libs/miniupnpc/receivedata.o \
13+
./libs/miniupnpc/upnpdev.o \
1414
./libs/miniupnpc/minissdpc.o
1515

1616

17-
LIBNATPMP_OBJS = \
18-
./libs/libnatpmp/natpmp.o \
19-
./libs/libnatpmp/getgateway.o \
20-
./libs/libnatpmp/wingettimeofday.o \
17+
LIBNATPMP_OBJS = \
18+
./libs/libnatpmp/natpmp.o \
19+
./libs/libnatpmp/getgateway.o \
20+
./libs/libnatpmp/wingettimeofday.o \
2121

2222

23-
ZLIB_OBJS = \
24-
./libs/zlib/adler32.o \
25-
./libs/zlib/deflate.o \
26-
./libs/zlib/inffast.o \
27-
./libs/zlib/inflate.o \
28-
./libs/zlib/inftrees.o \
29-
./libs/zlib/trees.o \
23+
ZLIB_OBJS = \
24+
./libs/zlib/adler32.o \
25+
./libs/zlib/deflate.o \
26+
./libs/zlib/inffast.o \
27+
./libs/zlib/inflate.o \
28+
./libs/zlib/inftrees.o \
29+
./libs/zlib/trees.o \
3030
./libs/zlib/zutil.o
3131

3232

33-
CRYPTO_OBJS = \
34-
./libs/ed25519/add_scalar.o \
35-
./libs/ed25519/fe.o \
36-
./libs/ed25519/ge.o \
37-
./libs/ed25519/key_exchange.o \
38-
./libs/ed25519/keypair.o \
39-
./libs/ed25519/sc.o \
40-
./libs/ed25519/seed.o \
41-
./libs/ed25519/sha512.o \
42-
./libs/ed25519/sign.o \
43-
./libs/ed25519/verify.o \
44-
./src/gnb_binary.o \
45-
./src/crypto/arc4/arc4.o \
33+
CRYPTO_OBJS = \
34+
./libs/ed25519/add_scalar.o \
35+
./libs/ed25519/fe.o \
36+
./libs/ed25519/ge.o \
37+
./libs/ed25519/key_exchange.o \
38+
./libs/ed25519/keypair.o \
39+
./libs/ed25519/sc.o \
40+
./libs/ed25519/seed.o \
41+
./libs/ed25519/sha512.o \
42+
./libs/ed25519/sign.o \
43+
./libs/ed25519/verify.o \
44+
./src/gnb_binary.o \
45+
./src/crypto/arc4/arc4.o \
4646
./src/crypto/random/gnb_random.o
4747

4848

49-
GNB_OBJS = \
50-
./src/gnb_core.o \
51-
./src/gnb_daemon.o \
52-
./src/gnb_worker.o \
53-
./src/gnb_ctl_block.o \
54-
./src/gnb_address.o \
55-
./src/gnb_primary_worker.o \
56-
./src/gnb_pf_worker.o \
57-
./src/gnb_node_worker.o \
58-
./src/gnb_index_worker.o \
59-
./src/gnb_index_service_worker.o \
60-
./src/gnb_detect_worker.o \
61-
./src/gnb_conf.o \
62-
./src/gnb_conf_file.o \
63-
./src/gnb_config_lite.o \
64-
./src/gnb_node.o \
65-
./src/gnb_udp.o \
66-
./src/gnb_payload16.o \
67-
./src/gnb_ring_buffer_fixed.o \
68-
./src/gnb_time.o \
69-
./src/gnb_lru32.o \
70-
./src/gnb_fixed_pool.o \
71-
./src/gnb_doubly_linked_list.o \
72-
./src/gnb_alloc.o \
73-
./src/gnb_mmap.o \
74-
./src/gnb_dir.o \
75-
./src/gnb_arg_list.o \
76-
./src/gnb_log.o \
77-
./src/gnb_hash32.o \
78-
./src/gnb_keys.o \
49+
GNB_OBJS = \
50+
./src/gnb_core.o \
51+
./src/gnb_daemon.o \
52+
./src/gnb_worker.o \
53+
./src/gnb_ctl_block.o \
54+
./src/gnb_address.o \
55+
./src/gnb_primary_worker.o \
56+
./src/gnb_pf_worker.o \
57+
./src/gnb_node_worker.o \
58+
./src/gnb_index_worker.o \
59+
./src/gnb_index_service_worker.o \
60+
./src/gnb_secure_index_worker.o \
61+
./src/gnb_secure_index_service_worker.o \
62+
./src/gnb_detect_worker.o \
63+
./src/gnb_conf.o \
64+
./src/gnb_conf_file.o \
65+
./src/gnb_config_lite.o \
66+
./src/gnb_node.o \
67+
./src/gnb_udp.o \
68+
./src/gnb_payload16.o \
69+
./src/gnb_ring_buffer_fixed.o \
70+
./src/gnb_time.o \
71+
./src/gnb_lru32.o \
72+
./src/gnb_fixed_pool.o \
73+
./src/gnb_doubly_linked_list.o \
74+
./src/gnb_alloc.o \
75+
./src/gnb_mmap.o \
76+
./src/gnb_dir.o \
77+
./src/gnb_arg_list.o \
78+
./src/gnb_log.o \
79+
./src/gnb_hash32.o \
80+
./src/gnb_keys.o \
81+
./src/gnb_nodeid.o \
7982
./libs/hash/murmurhash.o
8083

8184

@@ -89,41 +92,43 @@ GNB_PF_OBJS = \
8992
./src/packet_filter/gnb_pf_dump.o
9093

9194

92-
GNB_ES_OBJS = \
93-
./src/cli/gnb_es.o \
94-
./src/es/gnb_environment_service.o \
95-
./src/gnb_daemon.o \
96-
./src/es/gnb_es_dump.o \
97-
./src/es/gnb_es_broadcast_address.o \
98-
./src/es/gnb_es_resolv.o \
99-
./src/es/gnb_es_upnp.o \
100-
./src/es/gnb_discover_in_lan.o \
101-
./src/gnb_ctl_block.o \
102-
./src/gnb_time.o \
103-
./src/gnb_address.o \
104-
./src/gnb_payload16.o \
105-
./src/gnb_udp.o \
106-
./src/gnb_log.o \
107-
./src/gnb_alloc.o \
108-
./src/gnb_mmap.o \
109-
./src/gnb_dir.o \
110-
./src/gnb_hash32.o \
111-
./src/gnb_conf.o \
112-
./src/gnb_arg_list.o \
95+
GNB_ES_OBJS = \
96+
./src/cli/gnb_es.o \
97+
./src/es/gnb_environment_service.o \
98+
./src/gnb_daemon.o \
99+
./src/es/gnb_es_dump.o \
100+
./src/es/gnb_es_broadcast_address.o \
101+
./src/es/gnb_es_resolv.o \
102+
./src/es/gnb_es_upnp.o \
103+
./src/es/gnb_discover_in_lan.o \
104+
./src/gnb_ctl_block.o \
105+
./src/gnb_time.o \
106+
./src/gnb_address.o \
107+
./src/gnb_payload16.o \
108+
./src/gnb_udp.o \
109+
./src/gnb_log.o \
110+
./src/gnb_alloc.o \
111+
./src/gnb_mmap.o \
112+
./src/gnb_dir.o \
113+
./src/gnb_hash32.o \
114+
./src/gnb_conf.o \
115+
./src/gnb_arg_list.o \
116+
./src/gnb_nodeid.o \
113117
./libs/hash/murmurhash.o
114118

115119

116-
GNB_CTL_OBJS = \
117-
./src/cli/gnb_ctl.o \
118-
./src/ctl/gnb_ctl_dump.o \
119-
./src/gnb_ctl_block.o \
120-
./src/gnb_ctl_block_set.o \
121-
./src/gnb_binary.o \
122-
./src/gnb_time.o \
123-
./src/gnb_address.o \
124-
./src/gnb_payload16.o \
125-
./src/gnb_udp.o \
126-
./src/gnb_mmap.o \
120+
GNB_CTL_OBJS = \
121+
./src/cli/gnb_ctl.o \
122+
./src/ctl/gnb_ctl_dump.o \
123+
./src/gnb_ctl_block.o \
124+
./src/gnb_ctl_block_set.o \
125+
./src/gnb_binary.o \
126+
./src/gnb_time.o \
127+
./src/gnb_address.o \
128+
./src/gnb_payload16.o \
129+
./src/gnb_udp.o \
130+
./src/gnb_mmap.o \
131+
./src/gnb_nodeid.o \
127132
./libs/ed25519/sha512.o
128133

129134
GNB_OBJS += ./src/gnb_mod_register.o

src/gnb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ typedef struct _gnb_core_t{
171171
#define GNB_LOG_ID_INDEX_SERVICE_WORKER 5
172172
#define GNB_LOG_ID_DETECT_WORKER 6
173173

174-
#define GNB_VERSION_STRING "GNB version 1.5.0.a protocol version 1.5.0"
174+
#define GNB_VERSION_STRING "GNB version 1.5.0.b protocol version 1.5.0"
175175
#define GNB_COPYRIGHT_STRING "Copyright (C) 2019 gnbdev<[email protected]>"
176176
#define GNB_URL_STRING "https://github.com/gnbdev/opengnb"
177177

src/gnb_argv.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ void gnb_setup_es_argv(char *es_argv_string);
108108
#define SET_ZIP (GNB_OPT_INIT + 49)
109109
#define SET_ZIP_LEVEL (GNB_OPT_INIT + 50)
110110

111-
112111
#define SET_MEMORY_SCALE (GNB_OPT_INIT + 51)
113112

113+
#define SET_SAFE_INDEX (GNB_OPT_INIT + 52)
114+
114115
gnb_arg_list_t *gnb_es_arg_list;
115116

116117
int is_self_test = 0;
@@ -120,19 +121,13 @@ int is_trace = 0;
120121
gnb_conf_t* gnb_argv(int argc,char *argv[]){
121122

122123
gnb_conf_t *conf;
123-
124124
uint16_t port_host;
125-
126125
char *ctl_block_file = NULL;
127-
128126
int ret;
129-
130127
int num;
131128

132129
conf = malloc( sizeof(gnb_conf_t) );
133-
134130
memset(conf,0,sizeof(gnb_conf_t));
135-
136131
memset(&gnb_conf_ext_lite,0,sizeof(gnb_conf_ext_lite_t));
137132

138133
gnb_es_arg_list = gnb_arg_list_init(32);
@@ -152,12 +147,9 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
152147
conf->activate_detect_worker = 1;
153148

154149
conf->pf_worker_num = 0;
155-
156150
conf->direct_forwarding = 1;
157-
158151
conf->unified_forwarding = GNB_UNIFIED_FORWARDING_AUTO;
159-
160-
conf->universal_relay0 = 1;
152+
conf->universal_relay0 = 0;
161153

162154
/*
163155
IPv4最小MTU=576bytes
@@ -201,14 +193,12 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
201193

202194
conf->udp_socket_type = GNB_ADDR_TYPE_IPV4 | GNB_ADDR_TYPE_IPV6;
203195

204-
205196
conf->pf_woker_in_queue_length = 0xFFF;
206197
conf->pf_woker_out_queue_length = 0xFFF;
207198
conf->node_woker_queue_length = 0xFF;
208199
conf->index_woker_queue_length = 0xFF;
209200
conf->index_service_woker_queue_length = 0xFF;
210201

211-
212202
conf->udp6_socket_num = 1;
213203
conf->udp4_socket_num = 1;
214204

@@ -218,7 +208,7 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
218208

219209
conf->address_detect_interval_usec = GNB_ADDRESS_DETECT_INTERVAL_USEC;
220210
conf->full_detect_interval_sec = GNB_FULL_DETECT_INTERVAL_SEC;
221-
211+
conf->safe_index = 0;
222212
conf->daemon = 0;
223213
conf->systemd_daemon = 0;
224214

@@ -280,6 +270,7 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
280270
{ "nodeid", required_argument, 0, 'n' },
281271

282272
{ "public-index-service", no_argument, 0, 'P' },
273+
{ "safe-index", no_argument, 0, SET_SAFE_INDEX },
283274

284275
{ "index-address", required_argument, 0, 'I' },
285276
{ "node-address", required_argument, 0, 'a' },
@@ -329,7 +320,7 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
329320

330321
{ "port-detect", required_argument, 0, SET_PORT_DETECT },
331322

332-
{ "detect-interval", required_argument, 0, SET_DETECT_INTERVAL },
323+
{ "detect-interval", required_argument, 0, SET_DETECT_INTERVAL },
333324

334325
{ "set-tun", required_argument, 0, SET_TUN },
335326
{ "index-worker", required_argument, 0, SET_INDEX_WORKER },
@@ -406,7 +397,7 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
406397
break;
407398

408399
case 'n':
409-
conf->local_uuid = (uint64_t)strtoull(optarg, NULL, 10);
400+
conf->local_uuid = (gnb_uuid_t)strtoull(optarg, NULL, 10);
410401
conf->lite_mode = 1;
411402
break;
412403

@@ -482,6 +473,9 @@ gnb_conf_t* gnb_argv(int argc,char *argv[]){
482473
is_trace = 1;
483474
break;
484475

476+
case SET_SAFE_INDEX:
477+
conf->safe_index = 1;
478+
485479
case SET_SYSTEMD_DAEMON:
486480
conf->systemd_daemon = 1;
487481
break;
@@ -1094,7 +1088,7 @@ static void show_useage(int argc,char *argv[]){
10941088
#if defined(__linux__)
10951089
printf(" --systemd systemd daemon\n");
10961090
#endif
1097-
1091+
10981092
printf(" --node-worker-queue node worker queue length\n");
10991093
printf(" --index-worker-queue index worker queue length\n");
11001094
printf(" --index-service-worker-queue index service worker queue length\n");
@@ -1124,6 +1118,7 @@ static void show_useage(int argc,char *argv[]){
11241118
printf(" --address-secure hide part of ip address in logs \"on\",\"off\" default:\"on\"\n");
11251119
printf(" --if-dump dump the interface data frame \"on\",\"off\" default:\"off\"\n");
11261120
printf(" --pf-route packet filter route\n");
1121+
printf(" --safe-index \"on\",\"off\" default:\"off\"\n");
11271122
printf(" --multi-socket \"on\",\"off\" default:\"off\"\n");
11281123
printf(" --direct-forwarding \"on\",\"off\" default:\"on\"\n");
11291124
printf(" --set-tun \"on\",\"off\" default:\"on\"\n");

0 commit comments

Comments
 (0)