Skip to content

Commit

Permalink
fix: Bridge interface PVID set to 1 when returned as blank
Browse files Browse the repository at this point in the history
  • Loading branch information
gfenn-newbury committed Oct 24, 2022
1 parent 8fb46e8 commit f5cd515
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type InterfaceBridge struct {
VlanFiltering string `json:"vlan-filtering,omitempty"`
}

func (c *Client) CreateInterfaceBridge(ip_route *InterfaceBridge) (*InterfaceBridge, error) {
reqBody, err := json.Marshal(ip_route)
func (c *Client) CreateInterfaceBridge(interface_bridge *InterfaceBridge) (*InterfaceBridge, error) {
reqBody, err := json.Marshal(interface_bridge)
if err != nil {
return nil, err
}
Expand Down
6 changes: 6 additions & 0 deletions routeros/resource_interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ func resourceInterfaceBridgeCreate(d *schema.ResourceData, m interface{}) error
ingress_filtering, _ := strconv.ParseBool(res.IngressFiltering)
l2mtu, _ := strconv.Atoi(res.L2Mtu)
pvid, _ := strconv.Atoi(res.Pvid)
if pvid == 0 {
pvid = 1
}
running, _ := strconv.ParseBool(res.Running)
transmit_hold_count, _ := strconv.Atoi(res.TransmitHoldCount)
vlan_filtering, _ := strconv.ParseBool(res.VlanFiltering)
Expand Down Expand Up @@ -243,6 +246,9 @@ func resourceInterfaceBridgeRead(d *schema.ResourceData, m interface{}) error {
ingress_filtering, _ := strconv.ParseBool(res.IngressFiltering)
l2mtu, _ := strconv.Atoi(res.L2Mtu)
pvid, _ := strconv.Atoi(res.Pvid)
if pvid == 0 {
pvid = 1
}
running, _ := strconv.ParseBool(res.Running)
transmit_hold_count, _ := strconv.Atoi(res.TransmitHoldCount)
vlan_filtering, _ := strconv.ParseBool(res.VlanFiltering)
Expand Down

0 comments on commit f5cd515

Please sign in to comment.