+ arpresolve(): remove an unused argument

+ struct ifnet: remove unused fields, move ipv6-related field close
  to each other, add a pointer to l3<->l2 translation tables (arp,nd6,
  etc.) for future use.

+ struct route: remove an unused field, move close to each
  other some fields that might likely go away in the future
This commit is contained in:
Luigi Rizzo 2004-04-04 06:14:55 +00:00
parent be3d6f1dc5
commit f7c5baa1c6
5 changed files with 12 additions and 34 deletions

View File

@ -164,7 +164,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
if (!arpresolve(ifp, rt, m, dst, edst, rt0))
if (!arpresolve(ifp, rt, m, dst, edst))
return (0); /* if not yet resolved */
type = htons(ETHERTYPE_IP);
break;

View File

@ -158,30 +158,23 @@ struct ifnet {
(struct ifnet *, struct mbuf *);
void (*if_start) /* initiate output routine */
(struct ifnet *);
int (*if_done) /* output complete routine */
(struct ifnet *); /* (XXX not used; fake prototype) */
int (*if_ioctl) /* ioctl routine */
(struct ifnet *, u_long, caddr_t);
void (*if_watchdog) /* timer routine */
(struct ifnet *);
int (*if_poll_recv) /* polled receive routine */
(struct ifnet *, int *);
int (*if_poll_xmit) /* polled transmit routine */
(struct ifnet *, int *);
void (*if_poll_intren) /* polled interrupt reenable routine */
(struct ifnet *);
void (*if_poll_slowinput) /* input routine for slow devices */
(struct ifnet *, struct mbuf *);
void (*if_init) /* Init routine */
(void *);
int (*if_resolvemulti) /* validate/resolve multicast */
(struct ifnet *, struct sockaddr **, struct sockaddr *);
struct ifqueue if_snd; /* output queue */
struct ifqueue *if_poll_slowq; /* input queue for slow devices */
struct ifprefixhead if_prefixhead; /* list of prefixes per if */
const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
struct lltable *lltables; /* list of L3-L2 resolution tables */
struct label *if_label; /* interface MAC label */
/* these are only used by IPv6 */
struct ifprefixhead if_prefixhead; /* list of prefixes per if */
void *if_afdata[AF_MAX];
int if_afdata_initialized;
struct mtx if_afdata_mtx;
@ -478,13 +471,6 @@ int ifioctl(struct socket *, u_long, caddr_t, struct thread *);
int ifpromisc(struct ifnet *, int);
struct ifnet *ifunit(const char *);
int if_poll_recv_slow(struct ifnet *ifp, int *quotap);
void if_poll_xmit_slow(struct ifnet *ifp, int *quotap);
void if_poll_throttle(void);
void if_poll_unthrottle(void *);
void if_poll_init(void);
void if_poll(void);
struct ifaddr *ifa_ifwithaddr(struct sockaddr *);
struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
struct ifaddr *ifa_ifwithnet(struct sockaddr *);

View File

@ -107,17 +107,14 @@ struct rtentry {
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
struct sockaddr *rt_gateway; /* value */
long rt_refcnt; /* # held references */
u_long rt_flags; /* up/down?, host/net */
struct ifnet *rt_ifp; /* the answer: interface to use */
struct ifaddr *rt_ifa; /* the answer: interface address to use */
struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */
long rt_refcnt; /* # held references */
struct sockaddr *rt_genmask; /* for generation of cloned routes */
caddr_t rt_llinfo; /* pointer to link level info cache */
struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */
struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
int (*rt_output)(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
/* output routine for this (rt,if) */
struct rtentry *rt_parent; /* cloning parent of this route */
#ifdef _KERNEL
/* XXX ugly, user apps use this definition but don't have a mtx def */

View File

@ -347,13 +347,8 @@ arprequest(ifp, sip, tip, enaddr)
* taken over here, either now or for later transmission.
*/
int
arpresolve(ifp, rt, m, dst, desten, rt0)
struct ifnet *ifp;
struct rtentry *rt;
struct mbuf *m;
struct sockaddr *dst;
u_char *desten;
struct rtentry *rt0;
arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m,
struct sockaddr *dst, u_char *desten)
{
struct llinfo_arp *la = 0;
struct sockaddr_dl *sdl;

View File

@ -113,8 +113,8 @@ struct sockaddr_inarp {
extern u_char ether_ipmulticast_min[ETHER_ADDR_LEN];
extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN];
int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *, struct rtentry *);
int arpresolve(struct ifnet *ifp, struct rtentry *rt,
struct mbuf *m, struct sockaddr *dst, u_char *desten);
void arp_ifinit(struct ifnet *, struct ifaddr *);
#endif