You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2019/07/15 07:15:33 UTC

[mynewt-core] branch master updated (9e4c9bc -> 8205bc6)

This is an automated email from the ASF dual-hosted git repository.

marko pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from 9e4c9bc  hw/drivers/bma253: Add support for bma253 sensor notifications (#1912)
     new 609e0b3  net/ip/native_socket; change from MCAST_JOIN/LEAVE_GROUP to IP_ADD/DROP_MEMBERSHIP and IPV6_JOIN/LEAVE_GROUP. 32-bit compatibility library does not handle alignment change for MCAST_XXX_GROUP parameter when running on FreeBSD. net/ip/mn_socket; FreeBSD v6 multicast UDP sockets get outgoing data looped back even if they have not joined the group. Comment out part of the test which checks this.
     new 8205bc6  compiler/sim; update FreeBSD compiler to gcc8.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 compiler/sim/compiler.yml                    |  4 +-
 net/ip/mn_socket/selftest/src/mn_sock_util.c |  7 +++-
 net/ip/native_sockets/src/native_sock.c      | 55 +++++++++++++++-------------
 3 files changed, 37 insertions(+), 29 deletions(-)


[mynewt-core] 01/02: net/ip/native_socket; change from MCAST_JOIN/LEAVE_GROUP to IP_ADD/DROP_MEMBERSHIP and IPV6_JOIN/LEAVE_GROUP. 32-bit compatibility library does not handle alignment change for MCAST_XXX_GROUP parameter when running on FreeBSD. net/ip/mn_socket; FreeBSD v6 multicast UDP sockets get outgoing data looped back even if they have not joined the group. Comment out part of the test which checks this.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 609e0b38fc4007ee5a2bb863311fb5a20b0658d6
Author: Marko Kiiskila <ma...@apache.org>
AuthorDate: Thu Jul 11 18:46:24 2019 +0300

    net/ip/native_socket; change from MCAST_JOIN/LEAVE_GROUP to
    IP_ADD/DROP_MEMBERSHIP and IPV6_JOIN/LEAVE_GROUP. 32-bit compatibility
    library does not handle alignment change for MCAST_XXX_GROUP parameter
    when running on FreeBSD.
    net/ip/mn_socket; FreeBSD v6 multicast UDP sockets get outgoing data
    looped back even if they have not joined the group. Comment out part
    of the test which checks this.
---
 net/ip/mn_socket/selftest/src/mn_sock_util.c |  7 +++-
 net/ip/native_sockets/src/native_sock.c      | 55 +++++++++++++++-------------
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/net/ip/mn_socket/selftest/src/mn_sock_util.c b/net/ip/mn_socket/selftest/src/mn_sock_util.c
index c3334a4..4680292 100644
--- a/net/ip/mn_socket/selftest/src/mn_sock_util.c
+++ b/net/ip/mn_socket/selftest/src/mn_sock_util.c
@@ -732,6 +732,7 @@ sock_udp_mcast_v6(void)
      */
     memcpy(&msin6.msin6_addr, mcast_addr, sizeof(mcast_addr));
 
+#ifndef MN_FreeBSD
     rc = mn_sendto(tx_sock, (struct os_mbuf *)m, (struct mn_sockaddr *)&msin6);
     TEST_ASSERT(rc == 0);
 
@@ -740,11 +741,12 @@ sock_udp_mcast_v6(void)
      */
     rc = os_sem_pend(&test_sem, OS_TICKS_PER_SEC / 2);
     TEST_ASSERT(rc == OS_TIMEOUT);
+#endif
 
     mreq.mm_idx = loop_if_idx;
     mreq.mm_family = MN_AF_INET6;
     memcpy(&mreq.mm_addr.v6.s_addr, msin6.msin6_addr.s_addr,
-      sizeof(msin6.msin6_addr.s_addr));
+           sizeof(msin6.msin6_addr.s_addr));
 
     /*
      * Now join it.
@@ -779,12 +781,13 @@ sock_udp_mcast_v6(void)
     rc = os_mbuf_copyinto(m, 0, data, sizeof(data));
     TEST_ASSERT(rc == 0);
 
+#ifndef MN_FreeBSD
     rc = mn_sendto(tx_sock, (struct os_mbuf *)m, (struct mn_sockaddr *)&msin6);
     TEST_ASSERT(rc == 0);
 
     rc = os_sem_pend(&test_sem, OS_TICKS_PER_SEC);
     TEST_ASSERT(rc == OS_TIMEOUT);
-
+#endif
     mn_close(rx_sock);
     mn_close(tx_sock);
 }
diff --git a/net/ip/native_sockets/src/native_sock.c b/net/ip/native_sockets/src/native_sock.c
index 35cb5d0..bba83a5 100644
--- a/net/ip/native_sockets/src/native_sock.c
+++ b/net/ip/native_sockets/src/native_sock.c
@@ -604,14 +604,15 @@ native_sock_getsockopt(struct mn_socket *s, uint8_t level, uint8_t name,
 
 int
 native_sock_setsockopt(struct mn_socket *s, uint8_t level, uint8_t name,
-  void *val)
+                       void *val)
 {
     struct native_sock *ns = (struct native_sock *)s;
     int rc;
     uint32_t val32;
-    struct group_req greq;
-    struct sockaddr_in *sin;
-    struct sockaddr_in6 *sin6;
+    struct ip_mreq ip_mreq;
+    struct ipv6_mreq ipv6_mreq;
+    void *opt;
+    int opt_len;
     struct mn_mreq *mreq;
 
     if (level == MN_SO_LEVEL) {
@@ -619,33 +620,37 @@ native_sock_setsockopt(struct mn_socket *s, uint8_t level, uint8_t name,
         case MN_MCAST_JOIN_GROUP:
         case MN_MCAST_LEAVE_GROUP:
             mreq = val;
-            memset(&greq, 0, sizeof(greq));
-            greq.gr_interface = mreq->mm_idx;
             if (mreq->mm_family == MN_AF_INET) {
-                sin = (struct sockaddr_in *)&greq.gr_group;
-#ifndef MN_LINUX
-                sin->sin_len = sizeof(*sin);
-#endif
-                sin->sin_family = AF_INET;
-                memcpy(&sin->sin_addr, &mreq->mm_addr, sizeof(struct in_addr));
+                memset(&ip_mreq, 0, sizeof(ip_mreq));
+                if (native_sock_itf_addr(mreq->mm_idx,
+                                         &ip_mreq.imr_interface.s_addr)) {
+                    return MN_EADDRNOTAVAIL;
+                }
+                ip_mreq.imr_multiaddr.s_addr = mreq->mm_addr.v4.s_addr;
                 level = IPPROTO_IP;
+                if (name == MN_MCAST_JOIN_GROUP) {
+                    name = IP_ADD_MEMBERSHIP;
+                } else {
+                    name = IP_DROP_MEMBERSHIP;
+                }
+                opt = &ip_mreq;
+                opt_len = sizeof(ip_mreq);
             } else {
-                sin6 = (struct sockaddr_in6 *)&greq.gr_group;
-#ifndef MN_LINUX
-                sin6->sin6_len = sizeof(*sin6);
-#endif
-                sin6->sin6_family = AF_INET6;
-                memcpy(&sin6->sin6_addr, &mreq->mm_addr,
-                  sizeof(struct in6_addr));
+                memset(&ipv6_mreq, 0, sizeof(ipv6_mreq));
+                ipv6_mreq.ipv6mr_interface = mreq->mm_idx;
+                memcpy(&ipv6_mreq.ipv6mr_multiaddr, &mreq->mm_addr,
+                       sizeof(struct in6_addr));
                 level = IPPROTO_IPV6;
+                if (name == MN_MCAST_JOIN_GROUP) {
+                    name = IPV6_JOIN_GROUP;
+                } else {
+                    name = IPV6_LEAVE_GROUP;
+                }
+                opt = &ipv6_mreq;
+                opt_len = sizeof(ipv6_mreq);
             }
 
-            if (name == MN_MCAST_JOIN_GROUP) {
-                name = MCAST_JOIN_GROUP;
-            } else {
-                name = MCAST_LEAVE_GROUP;
-            }
-            rc = setsockopt(ns->ns_fd, level, name, &greq, sizeof(greq));
+            rc = setsockopt(ns->ns_fd, level, name, opt, opt_len);
             if (rc) {
                 return native_sock_err_to_mn_err(errno);
             }


[mynewt-core] 02/02: compiler/sim; update FreeBSD compiler to gcc8.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 8205bc6f3f72ed23d8ac87bb423398a62d437d19
Author: Marko Kiiskila <ma...@apache.org>
AuthorDate: Thu Jul 11 18:52:24 2019 +0300

    compiler/sim; update FreeBSD compiler to gcc8.
---
 compiler/sim/compiler.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/sim/compiler.yml b/compiler/sim/compiler.yml
index 01f6c69..8572dc6 100644
--- a/compiler/sim/compiler.yml
+++ b/compiler/sim/compiler.yml
@@ -47,7 +47,7 @@ compiler.path.objcopy.DARWIN.OVERWRITE: "gobjcopy"
 compiler.flags.base.DARWIN: [-DMN_OSX, -Wno-missing-braces]
 compiler.ld.resolve_circular_deps.DARWIN.OVERWRITE: false
 
-compiler.path.cc.FREEBSD.OVERWRITE: "gcc7"
-compiler.path.as.FREEBSD.OVERWRITE: "gcc7"
+compiler.path.cc.FREEBSD.OVERWRITE: "gcc8"
+compiler.path.as.FREEBSD.OVERWRITE: "gcc8"
 compiler.flags.base.FREEBSD: [-DMN_FreeBSD, -D_WITH_DPRINTF]
 compiler.ld.flags.FREEBSD.OVERWRITE: [-L/usr/lib32, -B/usr/lib32, -lutil]