SCCS-vsn: sys/vax/if/if_dmc.c 7.4
SCCS-vsn: sys/vax/if/if_dmv.c 7.6
SCCS-vsn: sys/vax/if/if_hy.c 7.3
SCCS-vsn: sys/vax/if/if_en.c 7.3
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)if_dmc.c 7.3 (Berkeley) %G%
+ * @(#)if_dmc.c 7.4 (Berkeley) %G%
m = if_ubaget(&sc->sc_ifuba, ifrw, len, off, ifp);
if (m == 0)
goto setup;
m = if_ubaget(&sc->sc_ifuba, ifrw, len, off, ifp);
if (m == 0)
goto setup;
- if (off) {
- ifp = *(mtod(m, struct ifnet **));
- m->m_off += 2 * sizeof (u_short);
- m->m_len -= 2 * sizeof (u_short);
- *(mtod(m, struct ifnet **)) = ifp;
- }
switch (dh->dmc_type) {
#ifdef INET
switch (dh->dmc_type) {
#ifdef INET
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
- off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
+ off = m->m_pkthdr.len - m->m_len;
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
- m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
+ (m->m_flags & M_EXT) == 0 &&
+ m->m_data >= m->m_pktdat + 2 * sizeof (u_short)) {
type = DMC_TRAILER + (off>>9);
type = DMC_TRAILER + (off>>9);
- m->m_off -= 2 * sizeof (u_short);
+ m->m_data -= 2 * sizeof (u_short);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)DMC_IPTYPE);
*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)DMC_IPTYPE);
*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
* Add local network header
* (there is space for a uba on a vax to step on)
*/
* Add local network header
* (there is space for a uba on a vax to step on)
*/
- if (m->m_off > MMAXOFF ||
- MMINOFF + sizeof(struct dmc_header) > m->m_off) {
- m = m_get(M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- error = ENOBUFS;
- goto bad;
- }
- m->m_next = m0;
- m->m_off = MMINOFF;
- m->m_len = sizeof (struct dmc_header);
- } else {
- m->m_off -= sizeof (struct dmc_header);
- m->m_len += sizeof (struct dmc_header);
+ M_PREPEND(m, sizeof(struct dmc_header), M_DONTWAIT);
+ if (m == 0) {
+ error = ENOBUFS;
+ goto bad;
}
dh = mtod(m, struct dmc_header *);
dh->dmc_type = htons((u_short)type);
}
dh = mtod(m, struct dmc_header *);
dh->dmc_type = htons((u_short)type);
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)if_dmv.c 7.5 (Berkeley) %G%
+ * @(#)if_dmv.c 7.6 (Berkeley) %G%
m = if_ubaget(&sc->sc_ifuba, ifrw, len, off, ifp);
if (m == 0)
goto setup;
m = if_ubaget(&sc->sc_ifuba, ifrw, len, off, ifp);
if (m == 0)
goto setup;
- if (off) {
- ifp = *(mtod(m, struct ifnet **));
- m->m_off += 2 * sizeof (u_short);
- m->m_len -= 2 * sizeof (u_short);
- *(mtod(m, struct ifnet **)) = ifp;
- }
switch (dh->dmv_type) {
#ifdef INET
case DMV_IPTYPE:
switch (dh->dmv_type) {
#ifdef INET
case DMV_IPTYPE:
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
- off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
+ off = m->m_pkthdr.len - m->m_len;
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
- m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
+ (m->m_flags & M_EXT) == 0 &&
+ m->m_data >= m->m_pktdat + 2 * sizeof (u_short)) {
type = DMV_TRAILER + (off>>9);
type = DMV_TRAILER + (off>>9);
- m->m_off -= 2 * sizeof (u_short);
+ m->m_data -= 2 * sizeof (u_short);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)DMV_IPTYPE);
*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)DMV_IPTYPE);
*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
* Add local network header
* (there is space for a uba on a vax to step on)
*/
* Add local network header
* (there is space for a uba on a vax to step on)
*/
- if (m->m_off > MMAXOFF ||
- MMINOFF + sizeof(struct dmv_header) > m->m_off) {
- m = m_get(M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- error = ENOBUFS;
- goto bad;
- }
- m->m_next = m0;
- m->m_off = MMINOFF;
- m->m_len = sizeof (struct dmv_header);
- } else {
- m->m_off -= sizeof (struct dmv_header);
- m->m_len += sizeof (struct dmv_header);
+ M_PREPEND(m, sizeof(struct dmv_header), M_DONTWAIT);
+ if (m == 0) {
+ error = ENOBUFS;
+ goto bad;
}
dh = mtod(m, struct dmv_header *);
dh->dmv_type = htons((u_short)type);
}
dh = mtod(m, struct dmv_header *);
dh->dmv_type = htons((u_short)type);
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)if_en.c 7.2 (Berkeley) %G%
+ * @(#)if_en.c 7.3 (Berkeley) %G%
{ enprobe, 0, enattach, 0, enstd, "en", eninfo };
#define ENUNIT(x) minor(x)
{ enprobe, 0, enattach, 0, enstd, "en", eninfo };
#define ENUNIT(x) minor(x)
-int eninit(),enoutput(),enreset(),enioctl();
+int eninit(),oldenoutput(),enreset(),enioctl(), enstart();
es->es_if.if_mtu = ENMTU;
es->es_if.if_flags = IFF_BROADCAST;
es->es_if.if_init = eninit;
es->es_if.if_mtu = ENMTU;
es->es_if.if_flags = IFF_BROADCAST;
es->es_if.if_init = eninit;
- es->es_if.if_output = enoutput;
+ es->es_if.if_output = oldenoutput;
+ es->es_if.if_start = enstart;
es->es_if.if_ioctl = enioctl;
es->es_if.if_reset = enreset;
es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16 | UBA_CANTWAIT;
es->es_if.if_ioctl = enioctl;
es->es_if.if_reset = enreset;
es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16 | UBA_CANTWAIT;
m = if_rubaget(&es->es_ifuba, len, off, &es->es_if);
if (m == 0)
goto setup;
m = if_rubaget(&es->es_ifuba, len, off, &es->es_if);
if (m == 0)
goto setup;
- if (off) {
- struct ifnet *ifp;
-
- ifp = *(mtod(m, struct ifnet **));
- m->m_off += 2 * sizeof (u_short);
- m->m_len -= 2 * sizeof (u_short);
- *(mtod(m, struct ifnet **)) = ifp;
- }
switch (en->en_type) {
#ifdef INET
switch (en->en_type) {
#ifdef INET
* Use trailer local net encapsulation if enough data in first
* packet leaves a multiple of 512 bytes of data in remainder.
*/
* Use trailer local net encapsulation if enough data in first
* packet leaves a multiple of 512 bytes of data in remainder.
*/
+oldenoutput(ifp, m0, dst)
struct ifnet *ifp;
struct mbuf *m0;
struct sockaddr *dst;
struct ifnet *ifp;
struct mbuf *m0;
struct sockaddr *dst;
error = EPERM; /* ??? */
goto bad;
}
error = EPERM; /* ??? */
goto bad;
}
- off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
+ off = m->m_pkthdr.len - m->m_len;
/* need per host negotiation */
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
/* need per host negotiation */
if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
if (off > 0 && (off & 0x1ff) == 0 &&
- m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
+ (m->m_flags & M_EXT) == 0 &&
+ m->m_data >= m->m_pktdat + 2 * sizeof (u_short)) {
type = ENTYPE_TRAIL + (off>>9);
type = ENTYPE_TRAIL + (off>>9);
- m->m_off -= 2 * sizeof (u_short);
+ m->m_data -= 2 * sizeof (u_short);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)ENTYPE_IP);
*(mtod(m, u_short *) + 1) = ntohs((u_short)m->m_len);
m->m_len += 2 * sizeof (u_short);
*mtod(m, u_short *) = htons((u_short)ENTYPE_IP);
*(mtod(m, u_short *) + 1) = ntohs((u_short)m->m_len);
* 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 (m->m_off > MMAXOFF ||
- MMINOFF + sizeof (struct en_header) > m->m_off) {
- MGET(m, M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- error = ENOBUFS;
- goto bad;
- }
- m->m_next = m0;
- m->m_off = MMINOFF;
- m->m_len = sizeof (struct en_header);
- } else {
- m->m_off -= sizeof (struct en_header);
- m->m_len += sizeof (struct en_header);
- }
+ M_PREPEND(m, sizeof (struct en_header), M_DONTWAIT);
+ if (m == NULL)
+ return (ENOBUFS);
en = mtod(m, struct en_header *);
/* add en_shost later */
en->en_dhost = dest;
en = mtod(m, struct en_header *);
/* add en_shost later */
en->en_dhost = dest;
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)if_hy.c 7.2 (Berkeley) %G%
+ * @(#)if_hy.c 7.3 (Berkeley) %G%
* No extra space for headers is allocated.
*/
mp = mtod(m, char *); /* save pointer to real message */
* No extra space for headers is allocated.
*/
mp = mtod(m, char *); /* save pointer to real message */
- if (m->m_off > MMAXOFF ||
- MMINOFF + sizeof(struct hym_hdr) > m->m_off) {
- m = m_get(M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- m = m0;
- error = ENOBUFS;
- goto drop;
- }
- m->m_next = m0;
- m->m_off = MMINOFF;
- m->m_len = sizeof(struct hym_hdr);
- } else {
- m->m_off -= sizeof(struct hym_hdr);
- m->m_len += sizeof(struct hym_hdr);
+ M_PREPEND(m, sizeof(struct hym_hdr), M_DONTWAIT);
+ if (m == 0) {
+ error = ENOBUFS;
+ goto bad;
dlen += sizeof(struct hym_hdr) - HYM_SWLEN;
hym = mtod(m, struct hym_hdr *);
dlen += sizeof(struct hym_hdr) - HYM_SWLEN;
hym = mtod(m, struct hym_hdr *);
- struct mbuf *m0;
-
- MGET(m0, M_DONTWAIT, MT_DATA);
- if (m0 == 0) {
+ M_PREPEND(m, sizeof(struct hym_hdr), M_DONTWAIT);
+ if (m == 0) {
- m0->m_off = MMINOFF;
- m0->m_len = sizeof(struct hym_hdr);
- m0->m_next = m;
- bcopy((caddr_t)hym, mtod(m0, caddr_t), sizeof(struct hym_hdr));
- m = m0;
+ bcopy((caddr_t)hym, mtod(m, caddr_t), sizeof(struct hym_hdr));
hypproto.sp_protocol = 0;
hypdst.sin_addr = is->hy_addr;
hypsrc.sin_addr = is->hy_addr;
hypproto.sp_protocol = 0;
hypdst.sin_addr = is->hy_addr;
hypsrc.sin_addr = is->hy_addr;