Skip to content

Commit 267d429

Browse files
committed
monitoring (5)
1 parent 414fe38 commit 267d429

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/build-test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: build and test
22

33
on:
44
push:
5-
schedule:
6-
- cron: '*/10 * * * *'
75

86

97
jobs:

src/core/connection.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static int connection_open_bind(struct scache_bind ibind, int listenfd)
154154
} tobind;
155155
int tobind_len;
156156
int res;
157+
int enable = 1;
157158

158159
switch (ibind.af)
159160
{
@@ -184,10 +185,16 @@ static int connection_open_bind(struct scache_bind ibind, int listenfd)
184185
default:
185186
FATAL("Unknown address family, cant bind");
186187
}
188+
189+
if(ibind.transparent){
190+
if(-1 == setsockopt(listenfd, SOL_IP, IP_TRANSPARENT, (const char*)&enable, sizeof(enable))){
191+
return -errno;
192+
}
193+
}
187194

188195
res = bind(listenfd, (sockaddr*)&tobind, tobind_len);
189196
if (res < 0) {
190-
return res;
197+
return -errno;
191198
}
192199

193200
if (ibind.af == AF_UNIX)

src/core/settings.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ static void parse_binds(const char* optarg_const, scache_binds* target)
133133
}
134134
break;
135135
case bind_parse_state::port:
136-
137-
if (optarg[i] == 0 || optarg[i] == ',')
136+
if(optarg[i] == 't'){
137+
current->transparent = true;
138+
}
139+
else if (optarg[i] == 0 || optarg[i] == ',')
138140
{
139-
optarg[i] = 0;
141+
optarg[current->transparent ? (i - 1) : i] = 0;
140142
current->port = atoi(optarg + state_start);
141143
if (copy == ',')
142144
{

src/core/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct scache_bind
88
int af;
99
char addr[sizeof(struct sockaddr_un)];//Largest IP address format supported
1010
int port;
11+
bool transparent;
1112
};
1213

1314
struct scache_binds {

0 commit comments

Comments
 (0)