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:
@@ -60,9 +60,8 @@ status_t std_ops(int32 op, ...);
|
|||||||
static int start_stack(void);
|
static int start_stack(void);
|
||||||
static int stop_stack(void);
|
static int stop_stack(void);
|
||||||
|
|
||||||
static int32 count_net_modules(void);
|
static status_t control_net_module(const char *name, uint32 op, void *data,
|
||||||
static const char *get_net_module_name(int32 index);
|
size_t length);
|
||||||
static status_t control_net_module(int32 index, uint32 op, void *data, size_t length);
|
|
||||||
|
|
||||||
static void add_protosw(struct protosw *[], int layer);
|
static void add_protosw(struct protosw *[], int layer);
|
||||||
static struct net_module *module_list = NULL;
|
static struct net_module *module_list = NULL;
|
||||||
@@ -93,11 +92,7 @@ struct core_module_info core_info = {
|
|||||||
|
|
||||||
start_stack,
|
start_stack,
|
||||||
stop_stack,
|
stop_stack,
|
||||||
|
|
||||||
count_net_modules,
|
|
||||||
get_net_module_name,
|
|
||||||
control_net_module,
|
control_net_module,
|
||||||
|
|
||||||
add_domain,
|
add_domain,
|
||||||
remove_domain,
|
remove_domain,
|
||||||
add_protocol,
|
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
|
static
|
||||||
status_t
|
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)
|
if(!module || !module->ptr->control)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
// no module found
|
||||||
|
|
||||||
return module->ptr->control(op, data, length);
|
return module->ptr->control(op, data, length);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,13 @@ ifioctl(struct socket *so, ulong cmd, caddr_t data)
|
|||||||
struct ifnet *ifp;
|
struct ifnet *ifp;
|
||||||
struct ifreq *ifr;
|
struct ifreq *ifr;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
printf("ifioctl(0x%lX)\n", cmd);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cmd == SIOCGIFCONF)
|
if (cmd == SIOCGIFCONF)
|
||||||
return (ifconf(cmd, data));
|
return (ifconf(cmd, data));
|
||||||
|
|
||||||
ifr = (struct ifreq*) data;
|
ifr = (struct ifreq*) data;
|
||||||
ifp = ifunit(ifr->ifr_name);
|
ifp = ifunit(ifr->ifr_name);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
@@ -92,6 +96,9 @@ ifioctl(struct socket *so, ulong cmd, caddr_t data)
|
|||||||
ifp->if_metric = ifr->ifr_metric;
|
ifp->if_metric = ifr->ifr_metric;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#if DEBUG
|
||||||
|
printf("ifioctl: Unknown cmd!\n");
|
||||||
|
#endif
|
||||||
if (so->so_proto == NULL)
|
if (so->so_proto == NULL)
|
||||||
return EOPNOTSUPP;
|
return EOPNOTSUPP;
|
||||||
return (*so->so_proto->pr_userreq)(so, PRU_CONTROL,
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct ifnet *
|
struct ifnet *
|
||||||
ifunit(char *name)
|
ifunit(char *name)
|
||||||
{
|
{
|
||||||
struct ifnet *d = devices;
|
struct ifnet *d = devices;
|
||||||
|
|
||||||
for (d=devices;d;d = d->if_next)
|
for (d=devices;d;d = d->if_next)
|
||||||
if (strcmp(d->if_name, name) == 0)
|
if (strcmp(d->if_name, name) == 0)
|
||||||
return d;
|
return d;
|
||||||
|
|||||||
@@ -410,8 +410,7 @@ on1:
|
|||||||
x = x->rn_right;
|
x = x->rn_right;
|
||||||
else
|
else
|
||||||
x = x->rn_left;
|
x = x->rn_left;
|
||||||
} while (b > abs(x->rn_bit));
|
} while (b > x->rn_bit && x->rn_bit >= 0);
|
||||||
/* x->rn_bit < b && x->rn_bit >= 0 */
|
|
||||||
#ifdef RN_DEBUG
|
#ifdef RN_DEBUG
|
||||||
if (rn_debug)
|
if (rn_debug)
|
||||||
log(LOG_DEBUG, "rn_insert: Going In:\n"), traverse(p);
|
log(LOG_DEBUG, "rn_insert: Going In:\n"), traverse(p);
|
||||||
|
|||||||
Reference in New Issue
Block a user