Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
d19c350e
Commit
d19c350e
authored
Nov 11, 2015
by
Robert Foss
Browse files
Added fix from #750, to access the IP of a sender of a UDP packet, to fix SDK 1.4.0 compability.
parent
38efa482
Changes
1
Show whitespace changes
Inline
Side-by-side
app/modules/enduser_setup.c
View file @
d19c350e
...
@@ -709,6 +709,15 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
...
@@ -709,6 +709,15 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
insert_byte
+=
(
uint32_t
)
sizeof
(
dns_body
);
insert_byte
+=
(
uint32_t
)
sizeof
(
dns_body
);
c_memcpy
(
&
(
dns_reply
[
insert_byte
]),
&
(
ip_info
.
ip
),
4
);
c_memcpy
(
&
(
dns_reply
[
insert_byte
]),
&
(
ip_info
.
ip
),
4
);
// SDK 1.4.0 changed behaviour, for UDP server need to look up remote ip/port
remot_info
*
pr
=
0
;
if
(
espconn_get_connection_info
(
callback_espconn
,
&
pr
,
0
)
!=
ESPCONN_OK
)
{
ENDUSER_SETUP_ERROR_VOID
(
"enduser_setup_dns_recv_callback failed. Unable to get IP of UDP sender."
,
ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND
,
ENDUSER_SETUP_ERR_FATAL
);
}
callback_espconn
->
proto
.
udp
->
remote_port
=
pr
->
remote_port
;
os_memmove
(
callback_espconn
->
proto
.
udp
->
remote_ip
,
pr
->
remote_ip
,
4
);
int8_t
err
;
int8_t
err
;
err
=
espconn_sent
(
callback_espconn
,
dns_reply
,
dns_reply_len
);
err
=
espconn_sent
(
callback_espconn
,
dns_reply
,
dns_reply_len
);
c_free
(
dns_reply
);
c_free
(
dns_reply
);
...
...
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