Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add support for incoming IP broadcast packets. The prot...
details: https://anonhg.NetBSD.org/src/rev/5870dc5a2b93
branches: trunk
changeset: 515094:5870dc5a2b93
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Sun Sep 16 15:08:39 2001 +0000
description:
Add support for incoming IP broadcast packets. The protocol for this is
worked out by observing RISC iX's behaviour, so it may be technically
wrong. The only implementations of IP-over-Econet for which I've got
sources don't support broadcasts.
Tested using broadcast ping from RISC iX to NetBSD, and using rwhod.
diffstat:
sys/arch/arm26/ioc/if_eca.c | 6 +++---
sys/net/if_eco.h | 4 +++-
sys/net/if_ecosubr.c | 34 +++++++++++++++++++++++++++++-----
3 files changed, 35 insertions(+), 9 deletions(-)
diffs (109 lines):
diff -r 82c9c74e4bd4 -r 5870dc5a2b93 sys/arch/arm26/ioc/if_eca.c
--- a/sys/arch/arm26/ioc/if_eca.c Sun Sep 16 13:57:56 2001 +0000
+++ b/sys/arch/arm26/ioc/if_eca.c Sun Sep 16 15:08:39 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eca.c,v 1.2 2001/09/15 17:27:24 bjh21 Exp $ */
+/* $NetBSD: if_eca.c,v 1.3 2001/09/16 15:08:40 bjh21 Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@@ -29,7 +29,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eca.c,v 1.2 2001/09/15 17:27:24 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eca.c,v 1.3 2001/09/16 15:08:40 bjh21 Exp $");
#include <sys/device.h>
#include <sys/malloc.h>
@@ -114,7 +114,7 @@
ifp->if_softc = sc;
ifp->if_init = eca_init;
ifp->if_stop = eca_stop;
- ifp->if_flags = IFF_SIMPLEX | IFF_NOTRAILERS;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
IFQ_SET_READY(&ifp->if_snd);
sc->sc_ec.ec_claimwire = eca_claimwire;
sc->sc_ec.ec_txframe = eca_txframe;
diff -r 82c9c74e4bd4 -r 5870dc5a2b93 sys/net/if_eco.h
--- a/sys/net/if_eco.h Sun Sep 16 13:57:56 2001 +0000
+++ b/sys/net/if_eco.h Sun Sep 16 15:08:39 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eco.h,v 1.2 2001/09/15 17:27:24 bjh21 Exp $ */
+/* $NetBSD: if_eco.h,v 1.3 2001/09/16 15:08:39 bjh21 Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@@ -98,6 +98,8 @@
/* Control bytes for IP */
#define ECO_CTL_IP 0x81
+#define ECO_CTL_IPBCAST_REPLY 0x8E
+#define ECO_CTL_IPBCAST_REQUEST 0x8F
#define ECO_CTL_ARP_REQUEST 0xA1
#define ECO_CTL_ARP_REPLY 0xA2
diff -r 82c9c74e4bd4 -r 5870dc5a2b93 sys/net/if_ecosubr.c
--- a/sys/net/if_ecosubr.c Sun Sep 16 13:57:56 2001 +0000
+++ b/sys/net/if_ecosubr.c Sun Sep 16 15:08:39 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ecosubr.c,v 1.6 2001/09/16 12:16:50 bjh21 Exp $ */
+/* $NetBSD: if_ecosubr.c,v 1.7 2001/09/16 15:08:39 bjh21 Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@@ -66,7 +66,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.6 2001/09/16 12:16:50 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.7 2001/09/16 15:08:39 bjh21 Exp $");
#include <sys/errno.h>
#include <sys/kernel.h>
@@ -341,7 +341,7 @@
{
struct ifqueue *inq;
struct eco_header ehdr, *eh;
- int s;
+ int s, i;
#ifdef INET
struct arphdr *ah;
struct eco_arp *ecah;
@@ -413,10 +413,34 @@
schednetisr(NETISR_ARP);
inq = &arpintrq;
break;
+ case ECO_CTL_IPBCAST_REQUEST:
+ {
+ struct sockaddr_storage dst_store;
+ struct sockaddr *dst = (struct sockaddr *)&dst_store;
+
+ /* Queue? */
+ memcpy(eh->eco_dhost, eh->eco_shost, ECO_ADDR_LEN);
+ eh->eco_control = ECO_CTL_IPBCAST_REPLY;
+ /* dst->sa_len??? */
+ dst->sa_family = AF_UNSPEC;
+ memcpy(dst->sa_data, eh, ECO_HDR_LEN);
+ ifp->if_output(ifp, m, dst, NULL);
+ return;
+ }
default:
- printf("%s: unknown IP stn %s ctl 0x%02x\n",
+ printf("%s: unknown IP stn %s ctl 0x%02x len %d:",
ifp->if_xname, eco_sprintf(eh->eco_shost),
- eh->eco_control);
+ eh->eco_control, m->m_pkthdr.len);
+ if (m->m_len == 0) {
+ m = m_pullup(m, 1);
+ if (m == 0) {
+ printf("\n");
+ goto drop;
+ }
+ }
+ for (i = 0; i < m->m_len; i++)
+ printf(" %02x", mtod(m, u_int8_t *)[i]);
+ printf("\n");
goto drop;
}
break;
Home |
Main Index |
Thread Index |
Old Index