Sort ports when created (or loaded)
All ports of an interface (show running-configuration) are sorted by ascending port number, but ISDN ports follow PSTN ports.
This commit is contained in:
parent
0e0e6fbbc8
commit
10e7687280
|
@ -350,7 +350,8 @@ void v5x_interface_free(struct v5x_interface *v5if) {
|
||||||
struct v5x_user_port *v5x_user_port_create(struct v5x_interface *v5if, uint16_t nr, enum v5x_user_type type,
|
struct v5x_user_port *v5x_user_port_create(struct v5x_interface *v5if, uint16_t nr, enum v5x_user_type type,
|
||||||
uint8_t ts1, uint8_t ts2)
|
uint8_t ts1, uint8_t ts2)
|
||||||
{
|
{
|
||||||
struct v5x_user_port *v5up;
|
struct v5x_user_port *v5up, *tmp;
|
||||||
|
struct llist_head *add;
|
||||||
int i;
|
int i;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -388,7 +389,16 @@ struct v5x_user_port *v5x_user_port_create(struct v5x_interface *v5if, uint16_t
|
||||||
if (!v5up)
|
if (!v5up)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
llist_add_tail(&v5up->list, &v5if->user_ports);
|
/* Insert in a sorted way: all port numbers in ascending order, but all ISDN ports behind PSTN ports */
|
||||||
|
add = &v5if->user_ports;
|
||||||
|
llist_for_each_entry(tmp, &v5if->user_ports, list) {
|
||||||
|
if (tmp->type == V5X_USER_TYPE_ISDN && type == V5X_USER_TYPE_PSTN)
|
||||||
|
break;
|
||||||
|
if (tmp->nr > nr && tmp->type == type)
|
||||||
|
break;
|
||||||
|
add = &tmp->list;
|
||||||
|
}
|
||||||
|
llist_add(&v5up->list, add);
|
||||||
|
|
||||||
v5up->interface = v5if;
|
v5up->interface = v5if;
|
||||||
v5up->nr = nr;
|
v5up->nr = nr;
|
||||||
|
|
Loading…
Reference in New Issue