github.com/osrg/gobgp/v3@v3.30.0/pkg/zebra/zapi_linux.go (about) 1 // Copyright (C) 2014, 2015 Nippon Telegraph and Telephone Corporation. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 // implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 package zebra 17 18 import ( 19 "strings" 20 "syscall" 21 ) 22 23 func intfflag2string(flag uint64) string { 24 ss := make([]string, 0, 10) 25 if flag&syscall.IFF_UP > 0 { 26 ss = append(ss, "UP") 27 } 28 if flag&syscall.IFF_BROADCAST > 0 { 29 ss = append(ss, "BROADCAST") 30 } 31 if flag&syscall.IFF_DEBUG > 0 { 32 ss = append(ss, "DEBUG") 33 } 34 if flag&syscall.IFF_LOOPBACK > 0 { 35 ss = append(ss, "LOOPBACK") 36 } 37 if flag&syscall.IFF_POINTOPOINT > 0 { 38 ss = append(ss, "POINTOPOINT") 39 } 40 if flag&syscall.IFF_NOTRAILERS > 0 { 41 ss = append(ss, "NOTRAILERS") 42 } 43 if flag&syscall.IFF_RUNNING > 0 { 44 ss = append(ss, "RUNNING") 45 } 46 if flag&syscall.IFF_NOARP > 0 { 47 ss = append(ss, "NOARP") 48 } 49 if flag&syscall.IFF_PROMISC > 0 { 50 ss = append(ss, "PROMISC") 51 } 52 if flag&syscall.IFF_ALLMULTI > 0 { 53 ss = append(ss, "ALLMULTI") 54 } 55 if flag&syscall.IFF_MASTER > 0 { 56 ss = append(ss, "MASTER") 57 } 58 if flag&syscall.IFF_SLAVE > 0 { 59 ss = append(ss, "SLAVE") 60 } 61 if flag&syscall.IFF_MULTICAST > 0 { 62 ss = append(ss, "MULTICAST") 63 } 64 if flag&syscall.IFF_PORTSEL > 0 { 65 ss = append(ss, "PORTSEL") 66 } 67 if flag&syscall.IFF_AUTOMEDIA > 0 { 68 ss = append(ss, "AUTOMEDIA") 69 } 70 if flag&syscall.IFF_DYNAMIC > 0 { 71 ss = append(ss, "DYNAMIC") 72 } 73 // if flag&syscall.IFF_LOWER_UP > 0 { 74 // ss = append(ss, "LOWER_UP") 75 // } 76 // if flag&syscall.IFF_DORMANT > 0 { 77 // ss = append(ss, "DORMANT") 78 // } 79 // if flag&syscall.IFF_ECHO > 0 { 80 // ss = append(ss, "ECHO") 81 // } 82 return strings.Join(ss, " | ") 83 }