Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
25b89cbe
Commit
25b89cbe
authored
Jun 19, 2023
by
Wang Xuancong
Committed by
Damien George
Sep 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/{modlwip,modsocket}: Add support for SO_BROADCAST socket option.
Signed-off-by:
Wang Xuancong
<
xuancong84@gmail.com
>
parent
db06041d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
extmod/modlwip.c
extmod/modlwip.c
+3
-1
extmod/modnetwork.h
extmod/modnetwork.h
+1
-0
extmod/modsocket.c
extmod/modsocket.c
+1
-0
No files found.
extmod/modlwip.c
View file @
25b89cbe
...
...
@@ -1377,7 +1377,8 @@ STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
switch
(
opt
)
{
// level: SOL_SOCKET
case
SOF_REUSEADDR
:
{
case
SOF_REUSEADDR
:
case
SOF_BROADCAST
:
{
mp_int_t
val
=
mp_obj_get_int
(
args
[
3
]);
// Options are common for UDP and TCP pcb's.
if
(
val
)
{
...
...
@@ -1786,6 +1787,7 @@ STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{
MP_ROM_QSTR
(
MP_QSTR_SOL_SOCKET
),
MP_ROM_INT
(
1
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_REUSEADDR
),
MP_ROM_INT
(
SOF_REUSEADDR
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_BROADCAST
),
MP_ROM_INT
(
SOF_BROADCAST
)
},
{
MP_ROM_QSTR
(
MP_QSTR_IPPROTO_IP
),
MP_ROM_INT
(
0
)
},
{
MP_ROM_QSTR
(
MP_QSTR_IP_ADD_MEMBERSHIP
),
MP_ROM_INT
(
IP_ADD_MEMBERSHIP
)
},
...
...
extmod/modnetwork.h
View file @
25b89cbe
...
...
@@ -43,6 +43,7 @@
// Common option flags per-socket.
#define MOD_NETWORK_SO_REUSEADDR (0x0004)
#define MOD_NETWORK_SO_BROADCAST (0x0020)
#define MOD_NETWORK_SO_KEEPALIVE (0x0008)
#define MOD_NETWORK_SO_SNDTIMEO (0x1005)
#define MOD_NETWORK_SO_RCVTIMEO (0x1006)
...
...
extmod/modsocket.c
View file @
25b89cbe
...
...
@@ -631,6 +631,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{
MP_ROM_QSTR
(
MP_QSTR_SOL_SOCKET
),
MP_ROM_INT
(
MOD_NETWORK_SOL_SOCKET
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_REUSEADDR
),
MP_ROM_INT
(
MOD_NETWORK_SO_REUSEADDR
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_BROADCAST
),
MP_ROM_INT
(
MOD_NETWORK_SO_BROADCAST
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_KEEPALIVE
),
MP_ROM_INT
(
MOD_NETWORK_SO_KEEPALIVE
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_SNDTIMEO
),
MP_ROM_INT
(
MOD_NETWORK_SO_SNDTIMEO
)
},
{
MP_ROM_QSTR
(
MP_QSTR_SO_RCVTIMEO
),
MP_ROM_INT
(
MOD_NETWORK_SO_RCVTIMEO
)
},
...
...
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