index.js
async function routeDelete(target, rootPwd) {
    const prevRoutes = await searchPrevRoutes(target);
    if (prevRoutes.length == 0) {
        return; // no need to do anything
    }
    const cmds = [];
    for (const prevRoute of prevRoutes) {
        cmds.push([
            'nmcli', 'connection', 'modify', prevRoute.connName,
            '-ipv4.routes', `${prevRoute.target} ${prevRoute.gatewayIP}`]);
        cmds.push(['nmcli', 'connection', 'down', prevRoute.connName]);
        cmds.push(['nmcli', 'connection', 'up', prevRoute.connName]);
    }
    return await executeCommands(cmds, null, {sudo: true, password: rootPwd});
}
async function routeDelete(target, rootPwd) {
    const prevRoutes = await searchPrevRoutes(target);
    if (prevRoutes.length == 0) {
        return; // no need to do anything
    }
    const cmds = [];
    for (const prevRoute of prevRoutes) {
        cmds.push([
            'nmcli', 'connection', 'modify', prevRoute.connName,
            '-ipv4.routes', `${prevRoute.target} ${prevRoute.gatewayIP}`]);
        cmds.push(['nmcli', 'connection', 'down', prevRoute.connName]);
        cmds.push(['nmcli', 'connection', 'up', prevRoute.connName]);
    }
    return await executeCommands(cmds, null, {sudo: true, password: rootPwd});
}
async function routeDelete ( target , rootPwd ) { const prevRoutes = await searchPrevRoutes ( target ) ; if ( prevRoutes . length == 0 ) { return ; // no need to do anything } const cmds = [ ] ; for ( const prevRoute of prevRoutes ) { cmds . push ( [ 'nmcli' , 'connection' , 'modify' , prevRoute . connName , '-ipv4.routes' , ` ${ prevRoute . target } ${ prevRoute . gatewayIP } ` ] ) ; cmds . push ( [ 'nmcli' , 'connection' , 'down' , prevRoute . connName ] ) ; cmds . push ( [ 'nmcli' , 'connection' , 'up' , prevRoute . connName ] ) ; } return await executeCommands ( cmds , null , { sudo : true , password : rootPwd } ) ; }
Delete static route from ipv4 network
@param {string} target : the destination network or host. e.g. 224.0.23.0/32
@param {string} rootPwd : root password for executing sudo
@return {Promise} Return standard output of each command as an array
Delete static route from ipv4 network