removed nodefiles and added raise interface functionnality
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//@ts-check
|
||||
const ip = require('../../core/ip')
|
||||
const fs = require('fs')
|
||||
const { exit } = require('process')
|
||||
|
||||
function usage() {
|
||||
console.log('invalid syntax')
|
||||
console.log('ifup [interface name]')
|
||||
}
|
||||
|
||||
if ( process.argv.length !== 4 ){
|
||||
usage()
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if ( !fs.existsSync('/sys/class/net/' + process.argv[3]) ) {
|
||||
console.log("Interface not found")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
let flags = ip.getFlags(process.argv[3])
|
||||
|
||||
flags |= ip.flags.IFF_UP
|
||||
|
||||
ip.setFlags(process.argv[3], flags)
|
||||
Reference in New Issue
Block a user