mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
IP.Interface: Fix the setting of LowerLayers to PPP.Interface.{i}.
This commit is contained in:
parent
d26fbbb4d9
commit
008f828760
3 changed files with 85 additions and 6 deletions
|
|
@ -1728,6 +1728,69 @@ Device.DHCPv4.Client.1.Interface => Device.IP.Interface.1
|
|||
$ obuspa -c get Device.Bridging.Bridge.*.Port.*.LowerLayers
|
||||
```
|
||||
|
||||
### 21. PPPoE WAN connection
|
||||
|
||||
- **TR-181 Commands**
|
||||
|
||||
```bash
|
||||
obuspa -c del Device.DHCPv4.Client.*
|
||||
obuspa -c del Device.DHCPv6.Client.*
|
||||
obuspa -c del Device.Ethernet.Link.*
|
||||
obuspa -c del Device.Bridging.Bridge.*
|
||||
obuspa -c del Device.IP.Interface.*
|
||||
|
||||
obuspa -c add Device.Ethernet.Link.
|
||||
obuspa -c set Device.Ethernet.Link.1.LowerLayers Device.Ethernet.Interface.3
|
||||
|
||||
obuspa -c add Device.PPP.Interface.
|
||||
obuspa -c set Device.PPP.Interface.1.LowerLayers Device.Ethernet.Link.1
|
||||
obuspa -c set Device.PPP.Interface.1.Username test
|
||||
obuspa -c set Device.PPP.Interface.1.Password test
|
||||
obuspa -c set Device.PPP.Interface.1.Enable 1
|
||||
|
||||
obuspa -c add Device.IP.Interface.
|
||||
obuspa -c set Device.IP.Interface.1.LowerLayers Device.PPP.Interface.1
|
||||
obuspa -c set Device.IP.Interface.1.Enable 1
|
||||
```
|
||||
|
||||
- **Network UCI Config**
|
||||
|
||||
```bash
|
||||
$ cat /etc/config/network
|
||||
|
||||
config interface 'loopback'
|
||||
option device 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config globals 'globals'
|
||||
option ula_prefix 'fd64:742f:d82c::/48'
|
||||
|
||||
config interface 'iface1'
|
||||
option device 'eth4'
|
||||
option proto 'pppoe'
|
||||
option username 'test'
|
||||
option password 'test'
|
||||
option disabled '0'
|
||||
option macaddr '44:D4:37:71:B5:53'
|
||||
|
||||
```
|
||||
|
||||
- **TR-181 Data Model**
|
||||
|
||||
```bash
|
||||
$ obuspa -c get Device.IP.Interface.*.LowerLayers
|
||||
Device.IP.Interface.1.LowerLayers => Device.PPP.Interface.1
|
||||
$ obuspa -c get Device.PPP.Interface.*.LowerLayers
|
||||
Device.PPP.Interface.1.LowerLayers => Device.Ethernet.Link.1
|
||||
$ obuspa -c get Device.Ethernet.VLANTermination.*.LowerLayers
|
||||
$ obuspa -c get Device.Ethernet.Link.*.LowerLayers
|
||||
Device.Ethernet.Link.1.LowerLayers => Device.Ethernet.Interface.3
|
||||
$ obuspa -c get Device.DHCPv4.Client.*.Interface
|
||||
$ obuspa -c get Device.Bridging.Bridge.*.Port.*.LowerLayers
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
- Regarding above scenarios, it's better to follow the sequence as described in each scenario to avoid misconfiguration issues
|
||||
|
|
|
|||
|
|
@ -1359,13 +1359,22 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
}
|
||||
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "device", &curr_device);
|
||||
update_child_interfaces(curr_device, "device", reference.value);
|
||||
|
||||
if (DM_STRNCMP(reference.path, "Device.PPP.Interface.", strlen("Device.PPP.Interface.")) == 0) {
|
||||
struct uci_section *ppp_s = get_dup_section_in_dmmap_opt("dmmap_ppp", "interface", "device", reference.value);
|
||||
dmuci_set_value_by_section_bbfdm(ppp_s, "iface_name", section_name((struct uci_section *)data));
|
||||
ppp___update_sections(ppp_s, (struct uci_section *)data);
|
||||
struct uci_section *ppp_s = get_dup_section_in_dmmap_opt("dmmap_ppp", "interface", "name", reference.value);
|
||||
if (ppp_s) {
|
||||
char *new_device = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(ppp_s, "device", &new_device);
|
||||
update_child_interfaces(curr_device, "device", new_device);
|
||||
|
||||
dmuci_set_value_by_section_bbfdm(ppp_s, "iface_name", section_name((struct uci_section *)data));
|
||||
ppp___update_sections(ppp_s, (struct uci_section *)data);
|
||||
}
|
||||
} else {
|
||||
update_child_interfaces(curr_device, "device", reference.value);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
uci_path_foreach_sections(bbfdm, "dmmap_ppp", "interface", s) {
|
||||
struct uci_section *iface_s = NULL;
|
||||
char *iface_name = NULL;
|
||||
char *curr_name = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(s, "iface_name", &iface_name);
|
||||
if (DM_STRLEN(iface_name))
|
||||
|
|
@ -131,6 +132,14 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
|
||||
inst = handle_instance(dmctx, parent_node, s, "ppp_int_instance", "ppp_int_alias");
|
||||
|
||||
dmuci_get_value_by_section_string(s, "name", &curr_name);
|
||||
if (!DM_STRLEN(curr_name)) {
|
||||
char name[8] = {0};
|
||||
|
||||
snprintf(name, sizeof(name), "ppp_%s", inst);
|
||||
dmuci_set_value_by_section(s, "name", name);
|
||||
}
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ppp_args, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
|
|
@ -284,8 +293,6 @@ static int set_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data,
|
|||
static int get_ppp_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_value_by_section_string(((struct ppp_args *)data)->dmmap_s, "name", value);
|
||||
if ((*value)[0] == '\0')
|
||||
*value = dmstrdup(section_name(((struct ppp_args *)data)->iface_s));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue