Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vpnsetup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
Zhang Huanjie
vpnsetup
Commits
9329605e
Commit
9329605e
authored
7 years ago
by
Zhang Huanjie
Browse files
Options
Downloads
Patches
Plain Diff
starttime
parent
fe0eae77
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sendstat.c
+9
-6
9 additions, 6 deletions
sendstat.c
with
9 additions
and
6 deletions
sendstat.c
+
9
−
6
View file @
9329605e
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
char
sendbuf
[
MAXLEN
];
char
sendbuf
[
MAXLEN
];
unsigned
long
int
ip
;
unsigned
long
int
ip
;
unsigned
int
port
;
unsigned
int
port
;
time_t
starttime
;
unsigned
long
int
my_aton
(
char
*
str
)
unsigned
long
int
my_aton
(
char
*
str
)
{
int
n1
,
n2
,
n3
,
n4
;
{
int
n1
,
n2
,
n3
,
n4
;
...
@@ -81,7 +81,10 @@ void getstat(void) {
...
@@ -81,7 +81,10 @@ void getstat(void) {
if
(
ret
>
0
)
len
+=
ret
;
if
(
ret
>
0
)
len
+=
ret
;
}
}
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
/* end of hostname */
/* starttime */
ret
=
snprintf
(
sendbuf
+
len
,
MAXLEN
-
len
,
"starttime=%ld
\n
"
,
starttime
);
if
(
ret
>
0
)
len
+=
ret
;
/* uptime */
/* uptime */
fp
=
fopen
(
"/proc/uptime"
,
"r"
);
fp
=
fopen
(
"/proc/uptime"
,
"r"
);
...
@@ -93,7 +96,7 @@ void getstat(void) {
...
@@ -93,7 +96,7 @@ void getstat(void) {
};
};
}
}
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
/* end uptime */
/* vpnindex */
/* vpnindex */
fp
=
fopen
(
"/etc/ethudp/SITE/INDEX"
,
"r"
);
fp
=
fopen
(
"/etc/ethudp/SITE/INDEX"
,
"r"
);
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
...
@@ -101,7 +104,7 @@ void getstat(void) {
...
@@ -101,7 +104,7 @@ void getstat(void) {
if
(
ret
>
0
)
len
+=
ret
;
if
(
ret
>
0
)
len
+=
ret
;
}
}
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
/* end of vpnindex */
/* SN */
/* SN */
fp
=
fopen
(
"/etc/ethudp/SITE/SN"
,
"r"
);
fp
=
fopen
(
"/etc/ethudp/SITE/SN"
,
"r"
);
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
...
@@ -109,7 +112,7 @@ void getstat(void) {
...
@@ -109,7 +112,7 @@ void getstat(void) {
if
(
ret
>
0
)
len
+=
ret
;
if
(
ret
>
0
)
len
+=
ret
;
}
}
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
/* end of SN */
/* ZC */
/* ZC */
fp
=
fopen
(
"/etc/ethudp/SITE/ZC"
,
"r"
);
fp
=
fopen
(
"/etc/ethudp/SITE/ZC"
,
"r"
);
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
if
((
fp
!=
NULL
)
&&
(
fgets
(
buf
,
MAXLEN
,
fp
)
!=
NULL
)
){
...
@@ -117,7 +120,6 @@ void getstat(void) {
...
@@ -117,7 +120,6 @@ void getstat(void) {
if
(
ret
>
0
)
len
+=
ret
;
if
(
ret
>
0
)
len
+=
ret
;
}
}
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
/* end of ZC */
}
}
...
@@ -144,6 +146,7 @@ int main(int argc,char*argv[])
...
@@ -144,6 +146,7 @@ int main(int argc,char*argv[])
setsid
();
setsid
();
signal
(
SIGCHLD
,
SIG_IGN
);
signal
(
SIGCHLD
,
SIG_IGN
);
ip
=
my_aton
(
"202.38.64.40"
);
ip
=
my_aton
(
"202.38.64.40"
);
starttime
=
time
(
NULL
);
port
=
6021
;
port
=
6021
;
if
(
argc
>=
2
)
if
(
argc
>=
2
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment