mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-20 01:38:41 +02:00
[management] Remove remaining backend linux router limitation (#3589)
This commit is contained in:
parent
3658215747
commit
09243a0fe0
@ -137,13 +137,6 @@ func (am *DefaultAccountManager) CreateRoute(ctx context.Context, accountID stri
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow non-Linux peers
|
|
||||||
if peer := account.GetPeer(peerID); peer != nil {
|
|
||||||
if peer.Meta.GoOS != "linux" {
|
|
||||||
return nil, status.Errorf(status.InvalidArgument, "non-linux peers are not supported as network routes")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(domains) > 0 && prefix.IsValid() {
|
if len(domains) > 0 && prefix.IsValid() {
|
||||||
return nil, status.Errorf(status.InvalidArgument, "domains and network should not be provided at the same time")
|
return nil, status.Errorf(status.InvalidArgument, "domains and network should not be provided at the same time")
|
||||||
}
|
}
|
||||||
@ -263,13 +256,6 @@ func (am *DefaultAccountManager) SaveRoute(ctx context.Context, accountID, userI
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow non-Linux peers
|
|
||||||
if peer := account.GetPeer(routeToSave.Peer); peer != nil {
|
|
||||||
if peer.Meta.GoOS != "linux" {
|
|
||||||
return status.Errorf(status.InvalidArgument, "non-linux peers are not supported as network routes")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(routeToSave.Domains) > 0 && routeToSave.Network.IsValid() {
|
if len(routeToSave.Domains) > 0 && routeToSave.Network.IsValid() {
|
||||||
return status.Errorf(status.InvalidArgument, "domains and network should not be provided at the same time")
|
return status.Errorf(status.InvalidArgument, "domains and network should not be provided at the same time")
|
||||||
}
|
}
|
||||||
|
@ -1117,14 +1117,14 @@ func TestGetNetworkMap_RouteSyncPeerGroups(t *testing.T) {
|
|||||||
|
|
||||||
peer2RoutesAfterDelete, err := am.GetNetworkMap(context.Background(), peer2ID)
|
peer2RoutesAfterDelete, err := am.GetNetworkMap(context.Background(), peer2ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Len(t, peer2RoutesAfterDelete.Routes, 2, "after peer deletion group should have 2 client routes")
|
assert.Len(t, peer2RoutesAfterDelete.Routes, 3, "after peer deletion group should have 3 client routes")
|
||||||
|
|
||||||
err = am.GroupDeletePeer(context.Background(), account.Id, groupHA2.ID, peer4ID)
|
err = am.GroupDeletePeer(context.Background(), account.Id, groupHA2.ID, peer4ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
peer2RoutesAfterDelete, err = am.GetNetworkMap(context.Background(), peer2ID)
|
peer2RoutesAfterDelete, err = am.GetNetworkMap(context.Background(), peer2ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Len(t, peer2RoutesAfterDelete.Routes, 1, "after peer deletion group should have only 1 route")
|
assert.Len(t, peer2RoutesAfterDelete.Routes, 2, "after peer deletion group should have only 2 routes")
|
||||||
|
|
||||||
err = am.GroupAddPeer(context.Background(), account.Id, groupHA2.ID, peer4ID)
|
err = am.GroupAddPeer(context.Background(), account.Id, groupHA2.ID, peer4ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -1135,7 +1135,7 @@ func TestGetNetworkMap_RouteSyncPeerGroups(t *testing.T) {
|
|||||||
|
|
||||||
peer2RoutesAfterAdd, err := am.GetNetworkMap(context.Background(), peer2ID)
|
peer2RoutesAfterAdd, err := am.GetNetworkMap(context.Background(), peer2ID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Len(t, peer2RoutesAfterAdd.Routes, 2, "HA route should have 2 client routes")
|
assert.Len(t, peer2RoutesAfterAdd.Routes, 3, "HA route should have 3 client routes")
|
||||||
|
|
||||||
err = am.DeleteRoute(context.Background(), account.Id, newRoute.ID, userID)
|
err = am.DeleteRoute(context.Background(), account.Id, newRoute.ID, userID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -1494,7 +1494,7 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*types.Accou
|
|||||||
{
|
{
|
||||||
ID: routeGroupHA1,
|
ID: routeGroupHA1,
|
||||||
Name: routeGroupHA1,
|
Name: routeGroupHA1,
|
||||||
Peers: []string{peer1.ID, peer2.ID, peer3.ID}, // we have one non Linux peer, see peer3
|
Peers: []string{peer1.ID, peer2.ID, peer3.ID},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: routeGroupHA2,
|
ID: routeGroupHA2,
|
||||||
|
@ -149,11 +149,6 @@ func (a *Account) getRoutingPeerRoutes(ctx context.Context, peerID string) (enab
|
|||||||
return enabledRoutes, disabledRoutes
|
return enabledRoutes, disabledRoutes
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently we support only linux routing peers
|
|
||||||
if peer.Meta.GoOS != "linux" {
|
|
||||||
return enabledRoutes, disabledRoutes
|
|
||||||
}
|
|
||||||
|
|
||||||
seenRoute := make(map[route.ID]struct{})
|
seenRoute := make(map[route.ID]struct{})
|
||||||
|
|
||||||
takeRoute := func(r *route.Route, id string) {
|
takeRoute := func(r *route.Route, id string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user