projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clean out printf
[unix-history]
/
usr
/
src
/
sys
/
vax
/
if
/
if_en.c
diff --git
a/usr/src/sys/vax/if/if_en.c
b/usr/src/sys/vax/if/if_en.c
index
e15236f
..
dee9fd3
100644
(file)
--- a/
usr/src/sys/vax/if/if_en.c
+++ b/
usr/src/sys/vax/if/if_en.c
@@
-1,4
+1,4
@@
-/* if_en.c 4.
17 81/12/03
*/
+/* if_en.c 4.
22 81/12/12
*/
#include "en.h"
#include "en.h"
@@
-27,7
+27,7
@@
#include "../net/ip.h"
#include "../net/ip_var.h"
#include "../net/ip.h"
#include "../net/ip_var.h"
-#define ENMTU
1024
+#define ENMTU
(1024+512)
int enprobe(), enattach(), enrint(), enxint(), encollide();
struct uba_device *eninfo[NEN];
int enprobe(), enattach(), enrint(), enxint(), encollide();
struct uba_device *eninfo[NEN];
@@
-100,7
+100,7
@@
COUNT(ENATTACH);
es->es_if.if_mtu = ENMTU;
es->es_if.if_net = ui->ui_flags;
es->es_if.if_host[0] =
es->es_if.if_mtu = ENMTU;
es->es_if.if_net = ui->ui_flags;
es->es_if.if_host[0] =
-
~(((struct endevice *)eninfo[ui->ui_unit])->en_addr
) & 0xff;
+
(~(((struct endevice *)eninfo[ui->ui_unit]->ui_addr)->en_addr)
) & 0xff;
es->es_if.if_addr =
if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]);
es->es_if.if_init = eninit;
es->es_if.if_addr =
if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]);
es->es_if.if_init = eninit;
@@
-193,6
+193,7
@@
COUNT(ENSTART);
es->es_oactive = 0;
return;
}
es->es_oactive = 0;
return;
}
+ dest = mtod(m, struct en_header *)->en_dhost;
es->es_olen = if_wubaput(&es->es_ifuba, m);
/*
es->es_olen = if_wubaput(&es->es_ifuba, m);
/*
@@
-201,7
+202,6
@@
COUNT(ENSTART);
* receiver, enforce a small delay (about 1ms) in interface
* on successive packets sent to same host.
*/
* receiver, enforce a small delay (about 1ms) in interface
* on successive packets sent to same host.
*/
- dest = mtod(m, struct en_header *)->en_dhost;
if (es->es_lastx && es->es_lastx == dest)
es->es_delay = enlastdel;
else
if (es->es_lastx && es->es_lastx == dest)
es->es_delay = enlastdel;
else
@@
-241,7
+241,7
@@
COUNT(ENXINT);
es->es_delay = 0;
es->es_mask = ~0;
if (addr->en_ostat&EN_OERROR)
es->es_delay = 0;
es->es_mask = ~0;
if (addr->en_ostat&EN_OERROR)
- printf("e
s
%d: output error\n", unit);
+ printf("e
n
%d: output error\n", unit);
if (es->es_if.if_snd.ifq_head == 0) {
es->es_if.if_oerrors++;
if (es->es_ifuba.ifu_xtofree) {
if (es->es_if.if_snd.ifq_head == 0) {
es->es_if.if_oerrors++;
if (es->es_ifuba.ifu_xtofree) {
@@
-274,7
+274,7
@@
COUNT(ENCOLLIDE);
* backed off 16 times, and give up.
*/
if (es->es_mask == 0) {
* backed off 16 times, and give up.
*/
if (es->es_mask == 0) {
- printf("e
s
%d: send error\n", unit);
+ printf("e
n
%d: send error\n", unit);
enxint(unit);
return;
}
enxint(unit);
return;
}
@@
-316,7
+316,7
@@
COUNT(ENRINT);
UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp);
if (addr->en_istat&EN_IERROR) {
es->es_if.if_ierrors++;
UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp);
if (addr->en_istat&EN_IERROR) {
es->es_if.if_ierrors++;
- printf("e
s
%d: input error\n", unit);
+ printf("e
n
%d: input error\n", unit);
goto setup;
}
goto setup;
}
@@
-345,7
+345,9
@@
COUNT(ENRINT);
#ifdef INET
case ENPUP_IPTYPE:
#ifdef INET
case ENPUP_IPTYPE:
- len = endataaddr(en, off, struct ip *)->ip_len;
+ len = htons((u_short)endataaddr(en, off ? off+2 : 0, struct ip *)->ip_len);
+ if (off)
+ len += 2;
setipintr();
inq = &ipintrq;
break;
setipintr();
inq = &ipintrq;
break;
@@
-365,6
+367,8
@@
COUNT(ENRINT);
* the two-byte type which is at the front of any trailer data.
*/
m = if_rubaget(&es->es_ifuba, len, off);
* the two-byte type which is at the front of any trailer data.
*/
m = if_rubaget(&es->es_ifuba, len, off);
+ if (m == 0)
+ goto setup;
if (off) {
m->m_off += 2;
m->m_len -= 2;
if (off) {
m->m_off += 2;
m->m_len -= 2;
@@
-404,7
+408,7
@@
enoutput(ifp, m0, pf)
int off;
dest = ip->ip_dst.s_addr >> 24;
int off;
dest = ip->ip_dst.s_addr >> 24;
- off =
ip->ip_len
- m->m_len;
+ off =
ntohs((u_short)ip->ip_len)
- m->m_len;
if (off > 0 && (off & 0x1ff) == 0 && m->m_off >= MMINOFF + 2) {
type = ENPUP_TRAIL + (off>>9);
m->m_off -= 2;
if (off > 0 && (off & 0x1ff) == 0 && m->m_off >= MMINOFF + 2) {
type = ENPUP_TRAIL + (off>>9);
m->m_off -= 2;
@@
-441,7
+445,8
@@
gottype:
* Add local net header. If no space in first mbuf,
* allocate another.
*/
* Add local net header. If no space in first mbuf,
* allocate another.
*/
- if (MMINOFF + sizeof (struct en_header) > m->m_off) {
+ if (m->m_off > MMAXOFF ||
+ MMINOFF + sizeof (struct en_header) > m->m_off) {
m = m_get(0);
if (m == 0) {
m_freem(m0);
m = m_get(0);
if (m == 0) {
m_freem(m0);
@@
-451,7
+456,6
@@
gottype:
m->m_off = MMINOFF;
m->m_len = sizeof (struct en_header);
} else {
m->m_off = MMINOFF;
m->m_len = sizeof (struct en_header);
} else {
- m = m0;
m->m_off -= sizeof (struct en_header);
m->m_len += sizeof (struct en_header);
}
m->m_off -= sizeof (struct en_header);
m->m_len += sizeof (struct en_header);
}