github.com/osrg/gobgp/v3@v3.30.0/pkg/zebra/zapi_bsd.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 //go:build freebsd || netbsd || openbsd 17 // +build freebsd netbsd openbsd 18 19 package zebra 20 21 import ( 22 "strings" 23 "syscall" 24 ) 25 26 func intfflag2string(flag uint64) string { 27 ss := make([]string, 0, 10) 28 if flag&syscall.IFF_UP > 0 { 29 ss = append(ss, "UP") 30 } 31 if flag&syscall.IFF_BROADCAST > 0 { 32 ss = append(ss, "BROADCAST") 33 } 34 if flag&syscall.IFF_DEBUG > 0 { 35 ss = append(ss, "DEBUG") 36 } 37 if flag&syscall.IFF_LOOPBACK > 0 { 38 ss = append(ss, "LOOPBACK") 39 } 40 if flag&syscall.IFF_POINTOPOINT > 0 { 41 ss = append(ss, "POINTOPOINT") 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_MULTICAST > 0 { 56 ss = append(ss, "MULTICAST") 57 } 58 return strings.Join(ss, " | ") 59 }