@@ -25,12 +25,6 @@ LOG_MODULE_REGISTER(ipsp);
2525#include <net/net_context.h>
2626#include <net/udp.h>
2727
28- /* admin-local, dynamically allocated multicast address */
29- #define MCAST_IP6ADDR { { { 0xff, 0x02, 0, 0, 0, 0, 0, 0, \
30- 0, 0, 0, 0, 0, 0, 0, 0x1 } } }
31-
32- struct in6_addr in6addr_mcast = MCAST_IP6ADDR ;
33-
3428/* Define my IP address where to expect messages */
3529#define MY_IP6ADDR { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, \
3630 0, 0, 0, 0, 0, 0, 0, 0x1 } } }
@@ -87,21 +81,14 @@ static inline void init_app(void)
8781 ifaddr = net_if_ipv6_addr_add (net_if_get_default (),
8882 & in6addr_my , NET_ADDR_MANUAL , 0 );
8983 } while (0 );
90-
91- net_if_ipv6_maddr_add (net_if_get_default (), & in6addr_mcast );
9284}
9385
9486static inline bool get_context (struct net_context * * udp_recv6 ,
95- struct net_context * * tcp_recv6 ,
96- struct net_context * * mcast_recv6 )
87+ struct net_context * * tcp_recv6 )
9788{
9889 int ret ;
99- struct sockaddr_in6 mcast_addr6 = { 0 };
10090 struct sockaddr_in6 my_addr6 = { 0 };
10191
102- net_ipaddr_copy (& mcast_addr6 .sin6_addr , & in6addr_mcast );
103- mcast_addr6 .sin6_family = AF_INET6 ;
104-
10592 my_addr6 .sin6_family = AF_INET6 ;
10693 my_addr6 .sin6_port = htons (MY_PORT );
10794
@@ -119,20 +106,6 @@ static inline bool get_context(struct net_context **udp_recv6,
119106 return false;
120107 }
121108
122- ret = net_context_get (AF_INET6 , SOCK_DGRAM , IPPROTO_UDP , mcast_recv6 );
123- if (ret < 0 ) {
124- LOG_ERR ("Cannot get receiving IPv6 mcast network context (%d)" ,
125- ret );
126- return false;
127- }
128-
129- ret = net_context_bind (* mcast_recv6 , (struct sockaddr * )& mcast_addr6 ,
130- sizeof (struct sockaddr_in6 ));
131- if (ret < 0 ) {
132- LOG_ERR ("Cannot bind IPv6 mcast (%d)" , ret );
133- return false;
134- }
135-
136109 ret = net_context_get (AF_INET6 , SOCK_STREAM , IPPROTO_TCP , tcp_recv6 );
137110 if (ret < 0 ) {
138111 LOG_ERR ("Cannot get network context for IPv6 TCP (%d)" , ret );
@@ -314,9 +287,8 @@ static void listen(void)
314287{
315288 struct net_context * udp_recv6 = { 0 };
316289 struct net_context * tcp_recv6 = { 0 };
317- struct net_context * mcast_recv6 = { 0 };
318290
319- if (!get_context (& udp_recv6 , & tcp_recv6 , & mcast_recv6 )) {
291+ if (!get_context (& udp_recv6 , & tcp_recv6 )) {
320292 LOG_ERR ("Cannot get network contexts" );
321293 return ;
322294 }
@@ -331,7 +303,6 @@ static void listen(void)
331303 LOG_INF ("Stopping..." );
332304
333305 net_context_put (udp_recv6 );
334- net_context_put (mcast_recv6 );
335306 net_context_put (tcp_recv6 );
336307}
337308
0 commit comments