Skip to content

Commit f47c5a6

Browse files
jukkarkartben
authored andcommitted
samples: net: mdns_responder: Refactor VLAN support
Move the common VLAN setup code to samples/net/common directory so that other network samples can utilize that too. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 723cbb6 commit f47c5a6

File tree

5 files changed

+5
-222
lines changed

5 files changed

+5
-222
lines changed

samples/net/mdns_responder/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ project(mdns_responder)
66

77
target_sources(app PRIVATE src/main.c)
88
target_sources(app PRIVATE src/service.c)
9-
target_sources_ifdef(CONFIG_NET_VLAN app PRIVATE src/vlan.c)
109

1110
include(${ZEPHYR_BASE}/samples/net/common/common.cmake)

samples/net/mdns_responder/Kconfig

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,5 @@
55

66
mainmenu "Networking mDNS responder sample application"
77

8-
config NET_SAMPLE_IFACE2_MY_IPV6_ADDR
9-
string "My IPv6 address for second interface"
10-
help
11-
The value depends on your network setup.
12-
13-
config NET_SAMPLE_IFACE2_MY_IPV4_ADDR
14-
string "My IPv4 address for second interface"
15-
help
16-
The value depends on your network setup.
17-
18-
config NET_SAMPLE_IFACE2_MY_IPV4_NETMASK
19-
string "My IPv4 netmask for second interface"
20-
help
21-
The value depends on your network setup.
22-
23-
config NET_SAMPLE_IFACE2_VLAN_TAG
24-
int "VLAN tag for second interface"
25-
default 100
26-
range 0 4094
27-
depends on NET_VLAN
28-
help
29-
Set VLAN (virtual LAN) tag (id) that is used in the sample
30-
application.
31-
32-
config NET_SAMPLE_IFACE3_MY_IPV6_ADDR
33-
string "My IPv6 address for third interface"
34-
help
35-
The value depends on your network setup.
36-
37-
config NET_SAMPLE_IFACE3_MY_IPV4_ADDR
38-
string "My IPv4 address for third interface"
39-
help
40-
The value depends on your network setup.
41-
42-
config NET_SAMPLE_IFACE3_MY_IPV4_NETMASK
43-
string "My IPv4 netmask for third interface"
44-
help
45-
The value depends on your network setup.
46-
47-
config NET_SAMPLE_IFACE3_VLAN_TAG
48-
int "VLAN tag for third interface"
49-
default 200
50-
range 0 4094
51-
depends on NET_VLAN
52-
help
53-
Set VLAN (virtual LAN) tag (id) that is used in the sample
54-
application.
55-
8+
source "samples/net/common/Kconfig"
569
source "Kconfig.zephyr"

samples/net/mdns_responder/overlay-vlan.conf

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,11 @@ CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
1111
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
1212
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
1313

14-
# Second ethernet interface will have these settings
15-
CONFIG_NET_SAMPLE_IFACE2_MY_IPV6_ADDR="2001:db8:100::1"
16-
# TEST-NET-2 from RFC 5737
17-
CONFIG_NET_SAMPLE_IFACE2_MY_IPV4_ADDR="198.51.100.1"
18-
CONFIG_NET_SAMPLE_IFACE2_MY_IPV4_NETMASK="255.255.255.0"
19-
# VLAN tag for the second interface
20-
CONFIG_NET_SAMPLE_IFACE2_VLAN_TAG=100
14+
# Second VLAN interface will have these settings
15+
CONFIG_NET_SAMPLE_COMMON_VLAN_SETUP_1="100;2001:db8:100::1/64,198.51.100.1/24"
2116

22-
# Settings for the third network interface
23-
CONFIG_NET_SAMPLE_IFACE3_MY_IPV6_ADDR="2001:db8:200::1"
24-
# TEST-NET-3 from RFC 5737
25-
CONFIG_NET_SAMPLE_IFACE3_MY_IPV4_ADDR="203.0.113.1"
26-
CONFIG_NET_SAMPLE_IFACE3_MY_IPV4_NETMASK="255.255.255.0"
27-
# VLAN tag for the second interface
28-
CONFIG_NET_SAMPLE_IFACE3_VLAN_TAG=200
17+
# Third VLAN interface will have these settings
18+
CONFIG_NET_SAMPLE_COMMON_VLAN_SETUP_2="200;2001:db8:200::1/64,203.0.113.1/24"
2919

3020
# Each interface needs at least 2 context. So if we have three
3121
# interfaces we need minimum 6 context but allocate more so that

samples/net/mdns_responder/src/main.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ LOG_MODULE_REGISTER(net_mdns_responder_sample, LOG_LEVEL_DBG);
1616

1717
extern void service(void);
1818

19-
#if defined(CONFIG_NET_VLAN)
20-
int init_vlan(void);
21-
#else
22-
static inline int init_vlan(void)
23-
{
24-
return 0;
25-
}
26-
#endif /* CONFIG_NET_VLAN */
27-
2819
/*
2920
* Note that mDNS support requires no application interaction with zephyr,
3021
* beyond optional runtime hostname configuration calls and setting

samples/net/mdns_responder/src/vlan.c

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)