1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Move ARP interface initialization into if_ether.c:arp_ifinit().

This commit is contained in:
Garrett Wollman 1994-12-22 21:56:22 +00:00
parent 186c582fdf
commit dd2e410221
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5195
17 changed files with 44 additions and 79 deletions

View File

@ -863,7 +863,7 @@ tulip_ioctl(
((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
tulip_addr_filter(sc); /* reset multicast filtering */
(*ifp->if_init)(ifp->if_unit);
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
}
#endif /* INET */
@ -1108,7 +1108,7 @@ tulip_pci_attach(
return;
}
bzero(sc, sizeof(*sc)); /* Zero out the softc*/
bzero(sc, sizeof(sc)); /* Zero out the softc*/
sc->tulip_rxspace = vm_page_alloc_contig(TULIP_RXSPACE + NBPG, 0, 0xffffffff, PAGE_SIZE);
/*
* We've allocated an extra page of receive space so we can double map

View File

@ -13,7 +13,7 @@
* the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
* and a variety of similar clones.
*
* $Id: if_ed.c,v 1.57 1994/11/24 14:29:16 davidg Exp $
* $Id: if_ed.c,v 1.58 1994/11/26 10:51:49 davidg Exp $
*/
#include "ed.h"
@ -1925,14 +1925,7 @@ ed_ioctl(ifp, command, data)
#ifdef INET
case AF_INET:
ed_init(ifp->if_unit); /* before arpwhohas */
/*
* See if another station has *our* IP address. i.e.:
* There is an address conflict! If a conflict exists,
* a message is sent to the console.
*/
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -1190,8 +1190,7 @@ epioctl(ifp, cmd, data)
#ifdef INET
case AF_INET:
epinit(ifp->if_unit); /* before arpwhohas */
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ie.c,v 1.18 1994/10/26 00:16:17 phk Exp $
* $Id: if_ie.c,v 1.19 1994/11/24 14:29:20 davidg Exp $
*/
/*
@ -1887,9 +1887,7 @@ ieioctl(ifp, command, data)
#ifdef INET
case AF_INET:
ieinit(ifp->if_unit);
((struct arpcom *)ifp)->ac_ipaddr =
IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif /* INET */

View File

@ -1509,8 +1509,7 @@ lnc_ioctl(struct ifnet * ifp, int command, caddr_t data)
#ifdef INET
case AF_INET:
lnc_init(ifp->if_unit);
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
default:

View File

@ -13,7 +13,7 @@
* the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
* and a variety of similar clones.
*
* $Id: if_ed.c,v 1.57 1994/11/24 14:29:16 davidg Exp $
* $Id: if_ed.c,v 1.58 1994/11/26 10:51:49 davidg Exp $
*/
#include "ed.h"
@ -1925,14 +1925,7 @@ ed_ioctl(ifp, command, data)
#ifdef INET
case AF_INET:
ed_init(ifp->if_unit); /* before arpwhohas */
/*
* See if another station has *our* IP address. i.e.:
* There is an address conflict! If a conflict exists,
* a message is sent to the console.
*/
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -6,7 +6,7 @@
*
* Questions, comments, bug reports and fixes to kimmel@cs.umass.edu.
*
* $Id: if_el.c,v 1.8 1994/10/23 21:27:17 wollman Exp $
* $Id: if_el.c,v 1.9 1994/11/24 14:29:17 davidg Exp $
*/
/* Except of course for the portions of code lifted from other FreeBSD
* drivers (mainly elread, elget and el_ioctl)
@ -701,14 +701,7 @@ el_ioctl(ifp, command, data)
#ifdef INET
case AF_INET:
el_init(ifp->if_unit); /* before arpwhohas */
/*
* See if another station has *our* IP address.
* i.e.: There is an address conflict! If a
* conflict exists, a message is sent to the
* console.
*/
((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -1190,8 +1190,7 @@ epioctl(ifp, cmd, data)
#ifdef INET
case AF_INET:
epinit(ifp->if_unit); /* before arpwhohas */
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ie.c,v 1.18 1994/10/26 00:16:17 phk Exp $
* $Id: if_ie.c,v 1.19 1994/11/24 14:29:20 davidg Exp $
*/
/*
@ -1887,9 +1887,7 @@ ieioctl(ifp, command, data)
#ifdef INET
case AF_INET:
ieinit(ifp->if_unit);
((struct arpcom *)ifp)->ac_ipaddr =
IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif /* INET */

View File

@ -11,7 +11,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
* $Id: if_is.c,v 1.31 1994/10/29 10:19:32 phk Exp $
* $Id: if_is.c,v 1.32 1994/11/24 14:29:22 davidg Exp $
*/
/* TODO
@ -945,15 +945,7 @@ is_ioctl(ifp, cmd, data)
#ifdef INET
case AF_INET:
is_init(ifp->if_unit); /* before arpwhohas */
/*
* See if another station has *our* IP address.
* i.e.: There is an address conflict! If a
* conflict exists, a message is sent to the
* console.
*/
((struct arpcom *)ifp)->ac_ipaddr =
IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS

View File

@ -605,8 +605,7 @@ le_ioctl(
#ifdef INET
case AF_INET: {
(*ifp->if_init)(ifp->if_unit);
((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
}
#endif /* INET */
@ -834,7 +833,7 @@ le_multi_op(
#define LEMAC_32K_MODE(mbase) (((mbase) >= 0x14) && ((mbase) <= 0x1F))
#define LEMAC_2K_MODE(mbase) ( (mbase) >= 0x40)
/* static int lemac_probe(le_softc_t *sc, const le_board_t *bd, int *msize); */
static int lemac_probe(le_softc_t *sc, const le_board_t *bd, int *msize);
static void lemac_init(int unit);
static void lemac_start(struct ifnet *ifp);
static void lemac_reset(IF_RESET_ARGS);
@ -847,10 +846,10 @@ static int lemac_read_eeprom(le_softc_t *sc);
static void lemac_init_adapmem(le_softc_t *sc);
static const le_mcbits_t lemac_allmulti_mctbl[16] = {
0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
0xFFFFU, 0xFFFFU, 0xFFFFU, 0xFFFFU,
0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
};
/*
* An IRQ mapping table. Less space than switch statement.
@ -1354,7 +1353,7 @@ lemac_init_adapmem(
* Start of DEPCA (DE200/DE201/DE202/DE422 etal) support.
*
*/
/* static int depca_probe(le_softc_t *sc, const le_board_t *bd, int *msize); */
static int depca_probe(le_softc_t *sc, const le_board_t *bd, int *msize);
static void depca_intr(le_softc_t *sc);
static int lance_init_adapmem(le_softc_t *sc);
static int lance_init_ring(le_softc_t *sc, ln_ring_t *rp, lance_ring_t *ri,

View File

@ -1509,8 +1509,7 @@ lnc_ioctl(struct ifnet * ifp, int command, caddr_t data)
#ifdef INET
case AF_INET:
lnc_init(ifp->if_unit);
((struct arpcom *) ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas((struct arpcom *) ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
default:

View File

@ -863,7 +863,7 @@ tulip_ioctl(
((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
tulip_addr_filter(sc); /* reset multicast filtering */
(*ifp->if_init)(ifp->if_unit);
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
}
#endif /* INET */
@ -1108,7 +1108,7 @@ tulip_pci_attach(
return;
}
bzero(sc, sizeof(*sc)); /* Zero out the softc*/
bzero(sc, sizeof(sc)); /* Zero out the softc*/
sc->tulip_rxspace = vm_page_alloc_contig(TULIP_RXSPACE + NBPG, 0, 0xffffffff, PAGE_SIZE);
/*
* We've allocated an extra page of receive space so we can double map

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.c 8.1 (Berkeley) 6/10/93
* $Id: if_ether.c,v 1.7 1994/11/02 00:58:29 wollman Exp $
* $Id: if_ether.c,v 1.8 1994/12/13 22:32:44 wollman Exp $
*/
/*
@ -632,3 +632,14 @@ arpioctl(cmd, data)
{
return (EOPNOTSUPP);
}
void
arp_ifinit(ac, ifa)
struct arpcom *ac;
struct ifaddr *ifa;
{
ac->ac_ipaddr = IA_SIN(ifa)->sin_addr;
arpwhohas(ac, &ac->ac_ipaddr);
ifa->ifa_rtrequest = arp_rtrequest;
ifa->ifa_flags |= RTF_CLONING;
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
* $Id: if_ether.h,v 1.4 1994/08/21 05:27:24 paul Exp $
* $Id: if_ether.h,v 1.5 1994/10/11 23:16:38 wollman Exp $
*/
#ifndef _NETINET_IF_ETHER_H_
@ -154,6 +154,7 @@ void arpintr __P((void));
int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *, struct rtentry *));
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arp_ifinit __P((struct arpcom *, struct ifaddr *));
int ether_addmulti __P((struct ifreq *, struct arpcom *));
int ether_delmulti __P((struct ifreq *, struct arpcom *));

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in.c 8.2 (Berkeley) 11/15/93
* $Id: in.c,v 1.6 1994/10/02 17:48:37 phk Exp $
* $Id: in.c,v 1.7 1994/11/03 21:04:21 wollman Exp $
*/
#include <sys/param.h>
@ -49,9 +49,7 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/if_ether.h>
#include <ether.h>
#ifdef INET
/*
* Return the network number from an internet address.
*/
@ -427,12 +425,6 @@ in_ifinit(ifp, ia, sin, scrub)
ia->ia_addr = oldaddr;
return (error);
}
#if NETHER > 0
if (ifp->if_output == ether_output) { /* XXX: Another Kludge */
ia->ia_ifa.ifa_rtrequest = arp_rtrequest;
ia->ia_ifa.ifa_flags |= RTF_CLONING;
}
#endif
splx(s);
if (scrub) {
ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr;
@ -631,4 +623,3 @@ in_delmulti(inm)
}
splx(s);
}
#endif

View File

@ -863,7 +863,7 @@ tulip_ioctl(
((struct arpcom *)ifp)->ac_ipaddr = IA_SIN(ifa)->sin_addr;
tulip_addr_filter(sc); /* reset multicast filtering */
(*ifp->if_init)(ifp->if_unit);
arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
}
#endif /* INET */
@ -1108,7 +1108,7 @@ tulip_pci_attach(
return;
}
bzero(sc, sizeof(*sc)); /* Zero out the softc*/
bzero(sc, sizeof(sc)); /* Zero out the softc*/
sc->tulip_rxspace = vm_page_alloc_contig(TULIP_RXSPACE + NBPG, 0, 0xffffffff, PAGE_SIZE);
/*
* We've allocated an extra page of receive space so we can double map