[PATCH 03/29] libnetworking: Fix ifr_tap.
Christian Mauderer
christian.mauderer at embedded-brains.de
Mon Apr 25 15:06:37 UTC 2016
From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>
---
cpukit/libnetworking/Makefile.am | 1 +
cpukit/libnetworking/net/if.c | 5 ++--
cpukit/libnetworking/preinstall.am | 4 +++
cpukit/libnetworking/rtems/rtems_net_if.h | 49 +++++++++++++++++++++++++++++++
4 files changed, 57 insertions(+), 2 deletions(-)
create mode 100644 cpukit/libnetworking/rtems/rtems_net_if.h
diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am
index 659be45..cf14ef0 100644
--- a/cpukit/libnetworking/Makefile.am
+++ b/cpukit/libnetworking/Makefile.am
@@ -144,6 +144,7 @@ include_rtems_HEADERS += rtems/ftpfs.h
include_rtems_HEADERS += rtems/mkrootfs.h
include_rtems_HEADERS += rtems/rtems_mii_ioctl.h
include_rtems_HEADERS += rtems/rtems_socket.h
+include_rtems_HEADERS += rtems/rtems_net_if.h
libnetworking_a_SOURCES += rtems/sghostname.c \
rtems/rtems_glue.c rtems/rtems_malloc_mbuf.c rtems/rtems_syscall.c \
diff --git a/cpukit/libnetworking/net/if.c b/cpukit/libnetworking/net/if.c
index d0da62a..1c4823a 100644
--- a/cpukit/libnetworking/net/if.c
+++ b/cpukit/libnetworking/net/if.c
@@ -50,6 +50,7 @@
#include <sys/sysctl.h>
#include <net/if.h>
+#include <rtems/rtems_net_if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/if_var.h>
@@ -660,11 +661,11 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
* RTEMS additions for setting/getting `tap' function
*/
case SIOCSIFTAP:
- ifp->if_tap = ifr->ifr_tap;
+ ifp->if_tap = ((struct rtems_ifreq *)ifr)->ifr_tap;
return 0;
case SIOCGIFTAP:
- ifr->ifr_tap = ifp->if_tap;
+ ((struct rtems_ifreq *)ifr)->ifr_tap = ifp->if_tap;
return 0;
}
return (0);
diff --git a/cpukit/libnetworking/preinstall.am b/cpukit/libnetworking/preinstall.am
index fb788e9..a92eb67 100644
--- a/cpukit/libnetworking/preinstall.am
+++ b/cpukit/libnetworking/preinstall.am
@@ -290,6 +290,10 @@ $(PROJECT_INCLUDE)/rtems/rtems_socket.h: rtems/rtems_socket.h $(PROJECT_INCLUDE)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems_socket.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_socket.h
+$(PROJECT_INCLUDE)/rtems/rtems_net_if.h: rtems/rtems_net_if.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems_net_if.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_net_if.h
+
$(PROJECT_INCLUDE)/sys/$(dirstamp):
@$(MKDIR_P) $(PROJECT_INCLUDE)/sys
@: > $(PROJECT_INCLUDE)/sys/$(dirstamp)
diff --git a/cpukit/libnetworking/rtems/rtems_net_if.h b/cpukit/libnetworking/rtems/rtems_net_if.h
new file mode 100644
index 0000000..96b108e
--- /dev/null
+++ b/cpukit/libnetworking/rtems/rtems_net_if.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef RTEMS_NET_H
+#define RTEMS_NET_H
+
+#include <rtems.h>
+#include <net/if.h>
+#include <net/if_var.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Forward structure declarations for function prototypes.
+ */
+struct mbuf;
+struct ether_header;
+struct ifnet;
+
+union rtems_ifrequ {
+ struct ifreq ifreq;
+ struct rtems_ifreq {
+ char ifr_name[IFNAMSIZ];
+ union {
+ int (*ifru_tap)(struct ifnet *,
+ struct ether_header *, struct mbuf *);
+ } ifr_ifru;
+#define ifr_tap ifr_ifru.ifru_tap /* tap function */
+ } rtems_ifrequ;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTEMS_NET_H */
--
1.8.4.5
More information about the devel
mailing list