#include <netat/sysglue.h>
#include <netat/appletalk.h>
+#include <netat/at_pcb.h>
#include <netat/at_var.h>
#include <netat/ddp.h>
#include <netat/lap.h>
#include <netat/zip.h>
#include <netat/nbp.h>
#include <netat/at_snmp.h>
-#include <netat/at_pcb.h>
#include <netat/at_aarp.h>
#include <netat/asp.h>
#include <netat/atp.h>
#include <netat/debug.h>
#include <netat/adsp.h>
#include <netat/adsp_internal.h>
+#include <netat/at_pat.h>
+#include <netat/rtmp.h>
#include <sys/kern_event.h>
/* externs */
extern TAILQ_HEAD(name_registry, _nve_) name_registry;
extern snmpStats_t snmpStats;
-extern atlock_t ddpinp_lock;
-extern atlock_t arpinp_lock;
extern short appletalk_inited;
extern int adspInited;
extern struct atpcb ddp_head;
extern lck_mtx_t * atalk_mutex;
/* protos */
-extern snmpAarpEnt_t * getAarp(int *);
-extern void nbp_shutdown(), routershutdown(), ddp_brt_shutdown();
-extern void ddp_brt_init(), rtmp_init(), rtmp_input();
-extern rtmp_router_start(at_kern_err_t *);
-static void getIfNames(at_ifnames_t *);
-static void add_route();
-static int set_zones();
-void elap_offline();
-static int elap_online1(), re_aarp();
-int at_reg_mcast(), at_unreg_mcast();
-void AARPwakeup(), ZIPwakeup();
-static void elap_hangup();
-static getSnmpCfg();
+int rtmp_router_start(at_kern_err_t *);
+static void add_route(RT_entry *);
+void elap_offline(at_ifaddr_t *);
+static int elap_online1(at_ifaddr_t *);
+static void elap_online2(at_ifaddr_t *);
+ int elap_online3(at_ifaddr_t *);
+static int re_aarp(at_ifaddr_t *);
+static int getSnmpCfg(snmpCfg_t *);
+
+int routerStart(at_kern_err_t *);
+
+static int validate_msg_size(gbuf_t *, gref_t *, at_ifaddr_t **);
+at_ifaddr_t *find_ifID(char *);
+int lap_online( at_ifaddr_t *, at_if_cfg_t *cfgp);
+
at_ifaddr_t *find_ifID(if_name)
char *if_name;
*/
{
register ioc_t *iocbp;
- register at_if_cfg_t *cfgp;
int i = 0, size = 1;
*elapp = NULL;
elapp->flags |= ELAP_CFG_SEED;
}
- if (!DEFAULT_ZONE(&cfgp->zonename) &&
- (elapp->flags & ELAP_CFG_HOME) || MULTIHOME_MODE) {
+ /* (VL) !? */
+ if ((!DEFAULT_ZONE(&cfgp->zonename) &&
+ (elapp->flags & ELAP_CFG_HOME)) || MULTIHOME_MODE) {
elapp->startup_zone = cfgp->zonename;
}
register ioc_t *iocbp;
register at_if_cfg_t *cfgp;
at_elap_stats_t *statsp;
- int i;
- int (*func)();
- gbuf_t *tmpm;
- at_ifaddr_t *patp;
+ int i,j;
+ int size, totalsize = 0, tabsize;
+ gbuf_t *mn; /* new gbuf */
+ gbuf_t *mo; /* old gbuf */
+ gbuf_t *mt = NULL; /* temp */
+ snmpNbpTable_t *nbp;
switch (gbuf_type(m)) {
kprintf("LAP_IOC_SNMP_GET_CFG\n");
#endif
{
- int i,size;
snmpCfg_t snmp;
i = *(int *)gbuf_rptr(gbuf_cont(m));
kprintf("LAP_IOC_SNMP_GET_ZIP\n");
#endif
{ /* matching brace NOT in this case */
- register int i,j;
- register int size, total, tabsize;
- gbuf_t *mn; /* new gbuf */
- gbuf_t *mo; /* old gbuf */
- gbuf_t *mt; /* temp */
- snmpNbpTable_t *nbp;
i = *(int *)gbuf_rptr(gbuf_cont(m));
gbuf_freem(gbuf_cont(m));
}
if (!mo) { /* if first new one */
mt = mn;
- total = size;
+ totalsize = size;
}
else {
gbuf_cont(mo) = mn;
- total += size;
+ totalsize += size;
}
mo = mn;
getZipTable((ZT_entry*)gbuf_rptr(mn),i,j);
if (!tabsize) {
dPrintf(D_M_ELAP,D_L_WARNING,
("elap_wput:snmp: empty zip table\n"));
- total = 0;
+ totalsize = 0;
}
- *(int*)gbuf_rptr(gbuf_cont(m)) = total; /* return table size */
+ *(int*)gbuf_rptr(gbuf_cont(m)) = totalsize; /* return table size */
gbuf_wset(gbuf_cont(m),sizeof(int));
iocbp->ioc_count = sizeof(int);
ioc_ack(0, m, gref);
}
if (!mo) { /* if first new one */
mt = mn;
- total = size;
+ totalsize = size;
}
else {
gbuf_cont(mo) = mn;
- total += size;
+ totalsize += size;
}
mo = mn;
getRtmpTable((RT_entry*)gbuf_rptr(mn),i,j);
break;
}
if (!tabsize)
- total = 0;
- *(int*)gbuf_rptr(gbuf_cont(m)) = total; /* return table size */
+ totalsize = 0;
+ *(int*)gbuf_rptr(gbuf_cont(m)) = totalsize; /* return table size */
gbuf_wset(gbuf_cont(m),sizeof(int));
iocbp->ioc_count = sizeof(int);
ioc_ack(0, m, gref);
}
if (!mo) { /* if first new one */
mt = mn;
- total = size;
+ totalsize = size;
nbp = (snmpNbpTable_t*)gbuf_rptr(mn);
nbp->nbpt_entries = tabsize;
nbp->nbpt_zone = ifID_home->ifZoneName;
}
else {
gbuf_cont(mo) = mn;
- total += size;
+ totalsize += size;
getNbpTable((snmpNbpEntry_t *)gbuf_rptr(mn),i,j);
}
mo = mn;
break;
}
if (!tabsize)
- total = 0;
- *(int*)gbuf_rptr(gbuf_cont(m)) = total; /* return table size */
+ totalsize = 0;
+ *(int*)gbuf_rptr(gbuf_cont(m)) = totalsize; /* return table size */
gbuf_wset(gbuf_cont(m),sizeof(int));
iocbp->ioc_count = sizeof(int);
ioc_ack(0, m, gref);
/* Called directly by ddp/zip.
*/
+int
elap_dataput(m, elapp, addr_flag, addr)
register gbuf_t *m;
register at_ifaddr_t *elapp;
{
register int size;
int error = 0;
- extern int zip_type_packet();
struct etalk_addr dest_addr;
struct atalk_addr dest_at_addr;
- extern gbuf_t *growmsg();
int loop = TRUE;
/* flag to aarp to loopback (default) */
* it doesn't know net#, consequently can't do
* AMT_LOOKUP. That task left to aarp now.
*/
- error = aarp_send_data(m,elapp,&dest_at_addr, loop);
+ error = aarp_send_data(m, elapp, &dest_at_addr, loop);
break;
case ET_ADDR :
- error = pat_output(elapp, m, &dest_addr, 0);
+ error = pat_output(elapp, m, (unsigned char *)&dest_addr, 0);
break;
}
return (error);
/* LD 081694: set the RTR_SEED_PORT flag for seed ports */
elapp->ifFlags |= RTR_SEED_PORT;
}
+#if DEBUG
else
dPrintf(D_M_ELAP,D_L_STARTUP_INFO,
("elap_online: it's a router, but non seed\n"));
+#endif
}
if (elapp->flags & ELAP_CFG_ZONELESS) {
register at_ifaddr_t *elapp;
{
- void zip_sched_getnetinfo(); /* forward reference */
- int errno;
- int s;
-
dPrintf(D_M_ELAP, D_L_SHUTDN_INFO, ("elap_offline:%s\n", elapp->ifName));
if (elapp->ifState != LAP_OFFLINE) {
(void)at_unreg_mcast(elapp, (caddr_t)&elapp->cable_multicast_addr);
elapp->ifState = LAP_OFFLINE;
- ATDISABLE(s, ddpinp_lock);
if (MULTIPORT_MODE)
RT_DELETE(elapp->ifThisCableEnd,
elapp->ifThisCableStart);
- ATENABLE(s, ddpinp_lock);
/* make sure no zip timeouts are left running */
elapp->ifGNIScheduled = 0;
struct atp_state *atp, *atp_next;
CCB *sp, *sp_next;
gref_t *gref;
- vm_offset_t temp_rcb_data, temp_state_data;
- int i, s, active_skts = 0; /* count of active pids for non-socketized
+ int i, active_skts = 0; /* count of active pids for non-socketized
AppleTalk protocols */
/* Network is shutting down... send error messages up on each open
sockets, but return EBUSY and don't complete shutdown. ***
*/
- s = splimp(); /* *** previously contained mismatched locking
- that was ifdef'ed to splimp() *** */
if (!count_only)
nbp_shutdown(); /* clear all known NVE */
atalk_notify(gref, ESHUTDOWN);
}
}
- if (count_only) {
- splx(s);
+ if (count_only)
return(active_skts);
- }
/* if there are no interfaces in the process of going online, continue shutting down DDP */
for (i = 0; i < IF_TOTAL_MAX; i++) {
if (at_interfaces[i].startup_inprogress == TRUE)
}
ddp_start();
- splx(s);
return(0);
} /* ddp_shutdown */
at_ifaddr_t *elapp;
int ZipError;
{
- int s, error = ZipError;
+ int error = ZipError;
- ATDISABLE(s, ddpinp_lock);
if ( (elapp != NULL) && elapp->startup_inprogress) {
- ATENABLE(s, ddpinp_lock);
/* was ZIPContinue */
/* was elapp_online() with jump to ZIP_sleep */
dPrintf(D_M_ELAP, D_L_STARTUP_INFO,
("elap_online: ifZipError=%d\n", error));
}
- } else
- ATENABLE(s, ddpinp_lock);
+ }
} /* ZIPwakeup */
void AARPwakeup(probe_cb)
aarp_amt_t *probe_cb;
{
- int s;
int errno;
at_ifaddr_t *elapp;
- ATDISABLE(s, arpinp_lock);
elapp = probe_cb->elapp;
if ( (elapp != NULL) && elapp->startup_inprogress && elapp->aa_ifp != 0) {
- ATENABLE(s, arpinp_lock);
/* was AARPContinue */
errno = aarp_init2(elapp);
("elap_online: aarp_init returns zero\n"));
elap_online2(elapp);
}
- } else
- ATENABLE(s, arpinp_lock);
+ }
} /* AARPwakeup */
void ddp_bit_reverse(addr)
addr[k] = reverse_data[addr[k]];
}
+static int elap_trackMcast(at_ifaddr_t *, int, caddr_t);
+
static int elap_trackMcast(patp, func, addr)
at_ifaddr_t *patp;
int func;
}
-static getSnmpCfg(snmp)
+static int getSnmpCfg(snmp)
snmpCfg_t *snmp;
{
int i;
*(unsigned*)data, (*(unsigned *)(data+2))&0x0000ffff,
(unsigned)ifID));
- if (if_addmulti(nddp, &sdl, 0))
+ if (if_addmulti(nddp, (struct sockaddr *)&sdl, 0))
return -1;
}
return 0;
(unsigned)ifID));
bzero(data, sizeof(struct etalk_addr));
- if (if_delmulti(nddp, &sdl))
+ if (if_delmulti(nddp, (struct sockaddr *)&sdl))
return -1;
}
return 0;