mirror of
https://github.com/luscis/openlan.git
synced 2025-10-05 16:47:11 +08:00
fix: restart openvpn without vrf master.
This commit is contained in:
@@ -64,7 +64,7 @@ type Router interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VPNer interface {
|
type VPNer interface {
|
||||||
RestartVpn()
|
RestartVPN()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Qoser interface {
|
type Qoser interface {
|
||||||
|
@@ -116,7 +116,7 @@ func (h Network) RestartVPN(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
worker.RestartVpn()
|
worker.RestartVPN()
|
||||||
|
|
||||||
ResponseJson(w, true)
|
ResponseJson(w, true)
|
||||||
}
|
}
|
||||||
|
@@ -428,25 +428,8 @@ func (w *WorkerImpl) UndoZTrust() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WorkerImpl) Start(v api.Switcher) {
|
func (w *WorkerImpl) letVPN2VRF() {
|
||||||
cfg, vpn := w.GetCfgs()
|
_, vpn := w.GetCfgs()
|
||||||
|
|
||||||
w.out.Info("WorkerImpl.Start")
|
|
||||||
|
|
||||||
w.loadVRF()
|
|
||||||
w.loadRoutes()
|
|
||||||
|
|
||||||
w.acl.Start()
|
|
||||||
w.toACL(cfg.Bridge.Name)
|
|
||||||
|
|
||||||
for _, output := range cfg.Outputs {
|
|
||||||
output.GenName()
|
|
||||||
w.addOutput(cfg.Bridge.Name, output)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !(w.vpn == nil) {
|
|
||||||
w.vpn.Start()
|
|
||||||
if !(w.vrf == nil) {
|
|
||||||
promise := libol.NewPromise()
|
promise := libol.NewPromise()
|
||||||
promise.Go(func() error {
|
promise.Go(func() error {
|
||||||
link, err := nl.LinkByName(vpn.Device)
|
link, err := nl.LinkByName(vpn.Device)
|
||||||
@@ -475,8 +458,29 @@ func (w *WorkerImpl) Start(v api.Switcher) {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WorkerImpl) Start(v api.Switcher) {
|
||||||
|
cfg, vpn := w.GetCfgs()
|
||||||
|
|
||||||
|
w.out.Info("WorkerImpl.Start")
|
||||||
|
|
||||||
|
w.loadVRF()
|
||||||
|
w.loadRoutes()
|
||||||
|
|
||||||
|
w.acl.Start()
|
||||||
|
w.toACL(cfg.Bridge.Name)
|
||||||
|
|
||||||
|
for _, output := range cfg.Outputs {
|
||||||
|
output.GenName()
|
||||||
|
w.addOutput(cfg.Bridge.Name, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !(w.vpn == nil) {
|
||||||
|
w.vpn.Start()
|
||||||
|
if !(w.vrf == nil) {
|
||||||
|
w.letVPN2VRF()
|
||||||
|
}
|
||||||
w.fire.Mangle.In.AddRule(cn.IPRule{
|
w.fire.Mangle.In.AddRule(cn.IPRule{
|
||||||
Input: vpn.Device,
|
Input: vpn.Device,
|
||||||
Jump: w.qos.ChainIn(),
|
Jump: w.qos.ChainIn(),
|
||||||
@@ -559,9 +563,12 @@ func (w *WorkerImpl) unloadRoutes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WorkerImpl) RestartVpn() {
|
func (w *WorkerImpl) RestartVPN() {
|
||||||
if w.vpn != nil {
|
if w.vpn != nil {
|
||||||
w.vpn.Restart()
|
w.vpn.Restart()
|
||||||
|
if !(w.vrf == nil) {
|
||||||
|
w.letVPN2VRF()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user