From: Lawrence S. <ljs...@us...> - 2014-06-04 21:35:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 38a612d447f0f2b5e533dd2cbb75d9f489652f7e (commit) via 07ccde0326c670cedaf30b3394f1fff9809f3951 (commit) from 0103890eb416dabf173909cc14a356fdf2927218 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 38a612d447f0f2b5e533dd2cbb75d9f489652f7e Author: Lawrence Sebald <ljs...@us...> Date: Wed Jun 4 17:33:01 2014 -0400 Add some support code for network devices that might not use ethernet to net_ipv4 and net_ipv6. commit 07ccde0326c670cedaf30b3394f1fff9809f3951 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jun 4 17:32:10 2014 -0400 Update the environ.sh.sample to match what dc-chain assumes. ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 4 ++-- include/kos/net.h | 2 +- kernel/net/net_ipv4.c | 11 +++++++++++ kernel/net/net_ipv6.c | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index 891288b..357aa12 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -20,7 +20,7 @@ export KOS_SUBARCH="pristine" # export KOS_SUBARCH="rte" # PS2 # KOS main base path -export KOS_BASE="/usr/local/home/bard/prj/svn/kos" +export KOS_BASE="/opt/toolchains/dc/kos" # Make utility export KOS_MAKE="make" @@ -55,7 +55,7 @@ export DC_ARM_BASE="/opt/toolchains/dc/arm-eabi" export DC_ARM_PREFIX="arm-eabi" # Expand PATH (comment out if you don't want this done here) -export PATH="${PATH}:${KOS_CC_BASE}/bin:/usr/local/dc/bin" +export PATH="${PATH}:${KOS_CC_BASE}/bin:/opt/toolchains/dc/bin" # Manually add our second addons tree export KOS_INC_PATHS="-I${KOS_BASE}/../kos-ports/include" diff --git a/include/kos/net.h b/include/kos/net.h index ae41958..8924671 100644 --- a/include/kos/net.h +++ b/include/kos/net.h @@ -182,6 +182,7 @@ typedef struct knetif { #define NETIF_RUNNING 0x00000008 /**< \brief Has start() been called? */ #define NETIF_PROMISC 0x00010000 /**< \brief Promiscuous mode */ #define NETIF_NEEDSPOLL 0x01000000 /**< \brief Needs to be polled for input */ +#define NETIF_NOETH 0x10000000 /**< \brief Does not use ethernet */ /** @} */ /* Return types for if_tx */ @@ -762,4 +763,3 @@ void net_shutdown(void); __END_DECLS #endif /* __KOS_NET_H */ - diff --git a/kernel/net/net_ipv4.c b/kernel/net/net_ipv4.c index 204cc58..4e12561 100644 --- a/kernel/net/net_ipv4.c +++ b/kernel/net/net_ipv4.c @@ -121,6 +121,17 @@ int net_ipv4_send_packet(netif_t *net, ip_hdr_t *hdr, const uint8 *data, return 0; } + else if(net->flags & NETIF_NOETH) { + /* Put the IP header / data into our packet */ + memcpy(pkt, hdr, 4 * (hdr->version_ihl & 0x0f)); + memcpy(pkt + 4 * (hdr->version_ihl & 0x0f), data, size); + + ++ipv4_stats.pkt_sent; + + /* Send it away */ + return net->if_tx(net, pkt, 4 * (hdr->version_ihl & 0x0f) + size, + NETIF_BLOCK); + } /* Are we sending a broadcast packet? */ if(hdr->dest == 0xFFFFFFFF || is_broadcast(dest_ip, net->broadcast)) { diff --git a/kernel/net/net_ipv6.c b/kernel/net/net_ipv6.c index 2070f86..266ff0d 100644 --- a/kernel/net/net_ipv6.c +++ b/kernel/net/net_ipv6.c @@ -83,6 +83,16 @@ int net_ipv6_send_packet(netif_t *net, ipv6_hdr_t *hdr, const uint8 *data, net_ipv6_input(NULL, pkt, sizeof(ipv6_hdr_t) + data_size, NULL); return 0; } + else if(net->flags & NETIF_NOETH) { + memcpy(pkt, hdr, sizeof(ipv6_hdr_t)); + memcpy(pkt + sizeof(ipv6_hdr_t), data, data_size); + + ++ipv6_stats.pkt_sent; + + /* Send the packet away */ + return net->if_tx(net, pkt, sizeof(ipv6_hdr_t) + data_size, + NETIF_BLOCK); + } else if(IN6_IS_ADDR_MULTICAST(&hdr->dst_addr)) { dst_mac[0] = dst_mac[1] = 0x33; dst_mac[2] = hdr->dst_addr.__s6_addr.__s6_addr8[12]; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |