projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[package] libnl: fix compilation with eglibc (closes: #4785)
[openwrt.git]
/
package
/
ead
/
src
/
ead-client.c
diff --git
a/package/ead/src/ead-client.c
b/package/ead/src/ead-client.c
index
74b0b43
..
54d8b13
100644
(file)
--- a/
package/ead/src/ead-client.c
+++ b/
package/ead/src/ead-client.c
@@
-44,6
+44,9
@@
static uint16_t nid = 0xffff;
struct sockaddr_in local, remote;
static int s = 0;
static int sockflags;
struct sockaddr_in local, remote;
static int s = 0;
static int sockflags;
+static struct in_addr serverip = {
+ .s_addr = 0x01010101 /* dummy */
+};
static unsigned char *skey = NULL;
static unsigned char bbuf[MAXPARAMLEN];
static unsigned char *skey = NULL;
static unsigned char bbuf[MAXPARAMLEN];
@@
-59,6
+62,7
@@
static struct t_num *A, B;
static struct t_preconf *tcp;
static int auth_type = EAD_AUTH_DEFAULT;
static int timeout = EAD_TIMEOUT;
static struct t_preconf *tcp;
static int auth_type = EAD_AUTH_DEFAULT;
static int timeout = EAD_TIMEOUT;
+static uint16_t sid = 0;
static void
set_nonblock(int enable)
static void
set_nonblock(int enable)
@@
-80,6
+84,7
@@
send_packet(int type, bool (*handler)(void), unsigned int max)
int res = 0;
type = htonl(type);
int res = 0;
type = htonl(type);
+ memcpy(&msg->ip, &serverip.s_addr, sizeof(msg->ip));
set_nonblock(0);
sendto(s, msgbuf, sizeof(struct ead_msg) + ntohl(msg->len), 0, (struct sockaddr *) &remote, sizeof(remote));
set_nonblock(1);
set_nonblock(0);
sendto(s, msgbuf, sizeof(struct ead_msg) + ntohl(msg->len), 0, (struct sockaddr *) &remote, sizeof(remote));
set_nonblock(1);
@@
-153,6
+158,7
@@
handle_pong(void)
auth_type = ntohs(pong->auth_type);
if (nid == 0xffff)
printf("%04x: %s\n", ntohs(msg->nid), pong->name);
auth_type = ntohs(pong->auth_type);
if (nid == 0xffff)
printf("%04x: %s\n", ntohs(msg->nid), pong->name);
+ sid = msg->sid;
return true;
}
return true;
}
@@
-294,8
+300,9
@@
send_command(const char *command)
static int
usage(const char *prog)
{
static int
usage(const char *prog)
{
- fprintf(stderr, "Usage: %s [-b <addr>] <node> <username>[:<password>] <command>\n"
+ fprintf(stderr, "Usage: %s [-
s <addr>] [-
b <addr>] <node> <username>[:<password>] <command>\n"
"\n"
"\n"
+ "\t-s <addr>: Set the server's source address to <addr>\n"
"\t-b <addr>: Set the broadcast address to <addr>\n"
"\t<node>: Node ID (4 digits hex)\n"
"\t<username>: Username to authenticate with\n"
"\t-b <addr>: Set the broadcast address to <addr>\n"
"\t<node>: Node ID (4 digits hex)\n"
"\t<username>: Username to authenticate with\n"
@@
-315,7
+322,7
@@
int main(int argc, char **argv)
int ch;
msg->magic = htonl(EAD_MAGIC);
int ch;
msg->magic = htonl(EAD_MAGIC);
- msg->
t
id = 0;
+ msg->
s
id = 0;
memset(&local, 0, sizeof(local));
memset(&remote, 0, sizeof(remote));
memset(&local, 0, sizeof(local));
memset(&remote, 0, sizeof(remote));
@@
-328,11
+335,16
@@
int main(int argc, char **argv)
local.sin_addr.s_addr = INADDR_ANY;
local.sin_port = 0;
local.sin_addr.s_addr = INADDR_ANY;
local.sin_port = 0;
- while ((ch = getopt(argc, argv, "b:")) != -1) {
+ while ((ch = getopt(argc, argv, "b:
s:h
")) != -1) {
switch(ch) {
switch(ch) {
+ case 's':
+ inet_aton(optarg, &serverip);
+ break;
case 'b':
inet_aton(optarg, &remote.sin_addr);
break;
case 'b':
inet_aton(optarg, &remote.sin_addr);
break;
+ case 'h':
+ return usage(prog);
}
}
argv += optind;
}
}
argv += optind;
@@
-395,12
+407,11
@@
int main(int argc, char **argv)
fprintf(stderr, "Device did not accept user name\n");
return 1;
}
fprintf(stderr, "Device did not accept user name\n");
return 1;
}
+ timeout = EAD_TIMEOUT_LONG;
if (!get_prime()) {
fprintf(stderr, "Failed to get user password info\n");
return 1;
}
if (!get_prime()) {
fprintf(stderr, "Failed to get user password info\n");
return 1;
}
-
- timeout = EAD_TIMEOUT_LONG;
if (!send_a()) {
fprintf(stderr, "Failed to send local authentication data\n");
return 1;
if (!send_a()) {
fprintf(stderr, "Failed to send local authentication data\n");
return 1;
This page took
0.024296 seconds
and
4
git commands to generate.