Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gdut-drcom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gdut-drcom
Commits
32b878c0
Commit
32b878c0
authored
Nov 10, 2016
by
chenhaowen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: option of enable crypt of keep alive1 packet2
parent
88f3e7c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
8 deletions
+21
-8
Makefile
Makefile
+2
-2
src/Makefile
src/Makefile
+1
-1
src/auth.c
src/auth.c
+11
-5
src/config.h
src/config.h
+1
-0
src/gdut-drcom.c
src/gdut-drcom.c
+6
-0
No files found.
Makefile
View file @
32b878c0
...
@@ -5,8 +5,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
...
@@ -5,8 +5,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_NAME
:=
gdut-drcom
PKG_NAME
:=
gdut-drcom
# Version: 1.0-1
# Version: 1.0-1
PKG_VERSION
:=
1.
5
PKG_VERSION
:=
1.
6
PKG_RELEASE
:=
5b
PKG_RELEASE
:=
0
PKG_MAINTAINER
:=
CHW
PKG_MAINTAINER
:=
CHW
# PKG_SOURCE_URL:=
# PKG_SOURCE_URL:=
define
Package/gdut-drcom
define
Package/gdut-drcom
...
...
src/Makefile
View file @
32b878c0
#CC:=gcc
#CC:=gcc
CFLAGS
+=
-Wall
-DDEBUG
-DVERSION
=
\"
1.
5-5b
\"
CFLAGS
+=
-Wall
-DDEBUG
-DVERSION
=
\"
1.
6-0
\"
objects
=
gdut-drcom.o config.o auth.o
objects
=
gdut-drcom.o config.o auth.o
...
...
src/auth.c
View file @
32b878c0
...
@@ -392,7 +392,10 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
...
@@ -392,7 +392,10 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
index
+=
4
;
index
+=
4
;
memcpy
(
buf
+
index
,
seed
,
4
);
memcpy
(
buf
+
index
,
seed
,
4
);
index
+=
4
;
index
+=
4
;
/**/
if
(
drcom_config
.
enable_crypt
==
0
)
{
/*disable crypt*/
int32_t
temp_num
;
int32_t
temp_num
;
temp_num
=
htole32
(
20000711
);
temp_num
=
htole32
(
20000711
);
memcpy
(
buf
+
index
,
(
uint8_t
*
)
&
temp_num
,
4
);
memcpy
(
buf
+
index
,
(
uint8_t
*
)
&
temp_num
,
4
);
...
@@ -406,9 +409,11 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
...
@@ -406,9 +409,11 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
index
+=
4
;
index
+=
4
;
memcpy
(
buf
+
index
,
"
\x00\x00\x00\x00
"
,
4
);
memcpy
(
buf
+
index
,
"
\x00\x00\x00\x00
"
,
4
);
index
+=
4
;
index
+=
4
;
/**/
/*disable crypt*/
}
/*
else
{
/*enable crypt*/
uint8_t
checksum
[
8
]
=
{
0
};
uint8_t
checksum
[
8
]
=
{
0
};
gen_ka1_checksum
(
checksum
,
seed
,
check_mode
);
gen_ka1_checksum
(
checksum
,
seed
,
check_mode
);
#ifdef DEBUG
#ifdef DEBUG
...
@@ -418,7 +423,8 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
...
@@ -418,7 +423,8 @@ static int make_keep_alive1_pkt2(uint8_t *buf, uint8_t *seed,\
#endif
#endif
memcpy
(
buf
+
index
,
checksum
,
8
);
memcpy
(
buf
+
index
,
checksum
,
8
);
index
+=
8
;
index
+=
8
;
*/
/*enable crypt*/
}
memset
(
buf
+
index
,
0x00
,
16
*
4
);
memset
(
buf
+
index
,
0x00
,
16
*
4
);
...
...
src/config.h
View file @
32b878c0
...
@@ -5,6 +5,7 @@ struct config_s {
...
@@ -5,6 +5,7 @@ struct config_s {
char
remote_ip
[
20
];
char
remote_ip
[
20
];
int
remote_port
;
int
remote_port
;
unsigned
char
keep_alive1_flag
;
unsigned
char
keep_alive1_flag
;
int
enable_crypt
;
};
};
extern
struct
config_s
drcom_config
;
extern
struct
config_s
drcom_config
;
...
...
src/gdut-drcom.c
View file @
32b878c0
...
@@ -32,6 +32,7 @@ int main(int argc, char *argv[])
...
@@ -32,6 +32,7 @@ int main(int argc, char *argv[])
{
"remote-ip"
,
required_argument
,
0
,
0
},
{
"remote-ip"
,
required_argument
,
0
,
0
},
{
"remote-port"
,
required_argument
,
0
,
1
},
{
"remote-port"
,
required_argument
,
0
,
1
},
{
"keep-alive1-flag"
,
required_argument
,
0
,
2
},
{
"keep-alive1-flag"
,
required_argument
,
0
,
2
},
{
"enable-crypt"
,
no_argument
,
0
,
3
},
{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
},
};
};
opt
=
getopt_long
(
argc
,
argv
,
"hc:"
,
long_options
,
&
option_index
);
opt
=
getopt_long
(
argc
,
argv
,
"hc:"
,
long_options
,
&
option_index
);
...
@@ -50,6 +51,9 @@ int main(int argc, char *argv[])
...
@@ -50,6 +51,9 @@ int main(int argc, char *argv[])
case
2
:
//keep_alive1_flag
case
2
:
//keep_alive1_flag
sscanf
(
optarg
,
"%02hhx"
,
&
drcom_config
.
keep_alive1_flag
);
sscanf
(
optarg
,
"%02hhx"
,
&
drcom_config
.
keep_alive1_flag
);
break
;
break
;
case
3
:
drcom_config
.
enable_crypt
=
1
;
break
;
case
'c'
:
case
'c'
:
strcpy
(
conf_file_name
,
optarg
);
strcpy
(
conf_file_name
,
optarg
);
parse_config
(
conf_file_name
);
parse_config
(
conf_file_name
);
...
@@ -72,6 +76,7 @@ int main(int argc, char *argv[])
...
@@ -72,6 +76,7 @@ int main(int argc, char *argv[])
fprintf
(
stdout
,
"drcom_config.remote_ip = %s
\n
"
,
drcom_config
.
remote_ip
);
fprintf
(
stdout
,
"drcom_config.remote_ip = %s
\n
"
,
drcom_config
.
remote_ip
);
fprintf
(
stdout
,
"drcom_config.remote_port = %d
\n
"
,
drcom_config
.
remote_port
);
fprintf
(
stdout
,
"drcom_config.remote_port = %d
\n
"
,
drcom_config
.
remote_port
);
fprintf
(
stdout
,
"drcom_config.keep_alive1_flag = %02hhx
\n
"
,
drcom_config
.
keep_alive1_flag
);
fprintf
(
stdout
,
"drcom_config.keep_alive1_flag = %02hhx
\n
"
,
drcom_config
.
keep_alive1_flag
);
fprintf
(
stdout
,
"drcom_config.enable_crypt = %d
\n
"
,
drcom_config
.
enable_crypt
);
fflush
(
stdout
);
fflush
(
stdout
);
#endif
#endif
...
@@ -99,6 +104,7 @@ static void print_help(char *name)
...
@@ -99,6 +104,7 @@ static void print_help(char *name)
fprintf
(
stdout
,
" [--remote-port <port>] The server port, default as 61440.
\n
"
);
fprintf
(
stdout
,
" [--remote-port <port>] The server port, default as 61440.
\n
"
);
fprintf
(
stdout
,
" [--keep-alive1-flag <flag>] The keep alive 1 packet's flag.
\n
"
fprintf
(
stdout
,
" [--keep-alive1-flag <flag>] The keep alive 1 packet's flag.
\n
"
" default as 00.
\n
"
);
" default as 00.
\n
"
);
fprintf
(
stdout
,
" [--enable-crypt] Enable crypt of keep alive1 packet2
\n
"
);
fprintf
(
stdout
,
" [-c, --config-file <file>] The path to config file.
\n
"
);
fprintf
(
stdout
,
" [-c, --config-file <file>] The path to config file.
\n
"
);
fprintf
(
stdout
,
" [-h, --help] Print this message.
\n
"
);
fprintf
(
stdout
,
" [-h, --help] Print this message.
\n
"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment