BUG fix.
Small changes for PPP. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5118 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d7fa7da88b
commit
f378b1b9c8
@ -60,9 +60,8 @@ status_t std_ops(int32 op, ...);
|
||||
static int start_stack(void);
|
||||
static int stop_stack(void);
|
||||
|
||||
static int32 count_net_modules(void);
|
||||
static const char *get_net_module_name(int32 index);
|
||||
static status_t control_net_module(int32 index, uint32 op, void *data, size_t length);
|
||||
static status_t control_net_module(const char *name, uint32 op, void *data,
|
||||
size_t length);
|
||||
|
||||
static void add_protosw(struct protosw *[], int layer);
|
||||
static struct net_module *module_list = NULL;
|
||||
@ -93,11 +92,7 @@ struct core_module_info core_info = {
|
||||
|
||||
start_stack,
|
||||
stop_stack,
|
||||
|
||||
count_net_modules,
|
||||
get_net_module_name,
|
||||
control_net_module,
|
||||
|
||||
add_domain,
|
||||
remove_domain,
|
||||
add_protocol,
|
||||
@ -217,57 +212,20 @@ struct core_module_info core_info = {
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
struct net_module*
|
||||
net_module_at(int32 index)
|
||||
{
|
||||
int32 currentIndex;
|
||||
struct net_module *current = module_list;
|
||||
|
||||
currentIndex = 0;
|
||||
for(; current && currentIndex != index; current = current->next)
|
||||
++currentIndex;
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int32
|
||||
count_net_modules(void)
|
||||
{
|
||||
int32 count;
|
||||
struct net_module *current = module_list;
|
||||
|
||||
count = 0;
|
||||
for(; current; current = current->next)
|
||||
++count;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
const char*
|
||||
get_net_module_name(int32 index)
|
||||
{
|
||||
struct net_module *module = net_module_at(index);
|
||||
|
||||
if(!module)
|
||||
return NULL;
|
||||
|
||||
return module->name;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
status_t
|
||||
control_net_module(int32 index, uint32 op, void *data, size_t length)
|
||||
control_net_module(const char *name, uint32 op, void *data, size_t length)
|
||||
{
|
||||
struct net_module *module = net_module_at(index);
|
||||
struct net_module *module = module_list;
|
||||
|
||||
for(; module; module = module->next) {
|
||||
if(module->name && !strcmp(module->name, name))
|
||||
break;
|
||||
}
|
||||
|
||||
if(!module || !module->ptr->control)
|
||||
return B_ERROR;
|
||||
// no module found
|
||||
|
||||
return module->ptr->control(op, data, length);
|
||||
}
|
||||
|
@ -62,9 +62,13 @@ ifioctl(struct socket *so, ulong cmd, caddr_t data)
|
||||
struct ifnet *ifp;
|
||||
struct ifreq *ifr;
|
||||
|
||||
#if DEBUG
|
||||
printf("ifioctl(0x%lX)\n", cmd);
|
||||
#endif
|
||||
|
||||
if (cmd == SIOCGIFCONF)
|
||||
return (ifconf(cmd, data));
|
||||
|
||||
|
||||
ifr = (struct ifreq*) data;
|
||||
ifp = ifunit(ifr->ifr_name);
|
||||
if (ifp == NULL)
|
||||
@ -92,6 +96,9 @@ ifioctl(struct socket *so, ulong cmd, caddr_t data)
|
||||
ifp->if_metric = ifr->ifr_metric;
|
||||
break;
|
||||
default:
|
||||
#if DEBUG
|
||||
printf("ifioctl: Unknown cmd!\n");
|
||||
#endif
|
||||
if (so->so_proto == NULL)
|
||||
return EOPNOTSUPP;
|
||||
return (*so->so_proto->pr_userreq)(so, PRU_CONTROL,
|
||||
@ -99,16 +106,19 @@ ifioctl(struct socket *so, ulong cmd, caddr_t data)
|
||||
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
printf("ifioctl: done\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct ifnet *
|
||||
ifunit(char *name)
|
||||
{
|
||||
struct ifnet *d = devices;
|
||||
|
||||
|
||||
for (d=devices;d;d = d->if_next)
|
||||
if (strcmp(d->if_name, name) == 0)
|
||||
return d;
|
||||
|
@ -410,8 +410,7 @@ on1:
|
||||
x = x->rn_right;
|
||||
else
|
||||
x = x->rn_left;
|
||||
} while (b > abs(x->rn_bit));
|
||||
/* x->rn_bit < b && x->rn_bit >= 0 */
|
||||
} while (b > x->rn_bit && x->rn_bit >= 0);
|
||||
#ifdef RN_DEBUG
|
||||
if (rn_debug)
|
||||
log(LOG_DEBUG, "rn_insert: Going In:\n"), traverse(p);
|
||||
|
Loading…
Reference in New Issue
Block a user