diff options
-rw-r--r-- | networking/interface.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/networking/interface.c b/networking/interface.c index 92d7f5dc0..9e6ed63e0 100644 --- a/networking/interface.c +++ b/networking/interface.c | |||
@@ -896,45 +896,6 @@ static void print_bytes_scaled(unsigned long long ull, const char *end) | |||
896 | printf("X bytes:%llu (%llu.%u %sB)%s", ull, int_part, frac_part, ext, end); | 896 | printf("X bytes:%llu (%llu.%u %sB)%s", ull, int_part, frac_part, ext, end); |
897 | } | 897 | } |
898 | 898 | ||
899 | static const char *const ife_print_flags_strs[] = { | ||
900 | "UP ", | ||
901 | "BROADCAST ", | ||
902 | "DEBUG ", | ||
903 | "LOOPBACK ", | ||
904 | "POINTOPOINT ", | ||
905 | "NOTRAILERS ", | ||
906 | "RUNNING ", | ||
907 | "NOARP ", | ||
908 | "PROMISC ", | ||
909 | "ALLMULTI ", | ||
910 | "SLAVE ", | ||
911 | "MASTER ", | ||
912 | "MULTICAST ", | ||
913 | #ifdef HAVE_DYNAMIC | ||
914 | "DYNAMIC " | ||
915 | #endif | ||
916 | }; | ||
917 | |||
918 | static const unsigned short ife_print_flags_mask[] = { | ||
919 | IFF_UP, | ||
920 | IFF_BROADCAST, | ||
921 | IFF_DEBUG, | ||
922 | IFF_LOOPBACK, | ||
923 | IFF_POINTOPOINT, | ||
924 | IFF_NOTRAILERS, | ||
925 | IFF_RUNNING, | ||
926 | IFF_NOARP, | ||
927 | IFF_PROMISC, | ||
928 | IFF_ALLMULTI, | ||
929 | IFF_SLAVE, | ||
930 | IFF_MASTER, | ||
931 | IFF_MULTICAST, | ||
932 | #ifdef HAVE_DYNAMIC | ||
933 | IFF_DYNAMIC | ||
934 | #endif | ||
935 | 0 | ||
936 | }; | ||
937 | |||
938 | static void ife_print(struct interface *ptr) | 899 | static void ife_print(struct interface *ptr) |
939 | { | 900 | { |
940 | const struct aftype *ap; | 901 | const struct aftype *ap; |
@@ -1059,12 +1020,51 @@ static void ife_print(struct interface *ptr) | |||
1059 | if (ptr->flags == 0) { | 1020 | if (ptr->flags == 0) { |
1060 | printf("[NO FLAGS] "); | 1021 | printf("[NO FLAGS] "); |
1061 | } else { | 1022 | } else { |
1062 | int i = 0; | 1023 | static const char ife_print_flags_strs[] = |
1024 | "UP\0" | ||
1025 | "BROADCAST\0" | ||
1026 | "DEBUG\0" | ||
1027 | "LOOPBACK\0" | ||
1028 | "POINTOPOINT\0" | ||
1029 | "NOTRAILERS\0" | ||
1030 | "RUNNING\0" | ||
1031 | "NOARP\0" | ||
1032 | "PROMISC\0" | ||
1033 | "ALLMULTI\0" | ||
1034 | "SLAVE\0" | ||
1035 | "MASTER\0" | ||
1036 | "MULTICAST\0" | ||
1037 | #ifdef HAVE_DYNAMIC | ||
1038 | "DYNAMIC\0" | ||
1039 | #endif | ||
1040 | ; | ||
1041 | static const unsigned short ife_print_flags_mask[] = { | ||
1042 | IFF_UP, | ||
1043 | IFF_BROADCAST, | ||
1044 | IFF_DEBUG, | ||
1045 | IFF_LOOPBACK, | ||
1046 | IFF_POINTOPOINT, | ||
1047 | IFF_NOTRAILERS, | ||
1048 | IFF_RUNNING, | ||
1049 | IFF_NOARP, | ||
1050 | IFF_PROMISC, | ||
1051 | IFF_ALLMULTI, | ||
1052 | IFF_SLAVE, | ||
1053 | IFF_MASTER, | ||
1054 | IFF_MULTICAST, | ||
1055 | #ifdef HAVE_DYNAMIC | ||
1056 | IFF_DYNAMIC, | ||
1057 | #endif | ||
1058 | }; | ||
1059 | const unsigned short *mask = ife_print_flags_mask; | ||
1060 | const char *str = ife_print_flags_strs; | ||
1063 | do { | 1061 | do { |
1064 | if (ptr->flags & ife_print_flags_mask[i]) { | 1062 | if (ptr->flags & *mask) { |
1065 | printf(ife_print_flags_strs[i]); | 1063 | printf("%s ", str); |
1066 | } | 1064 | } |
1067 | } while (ife_print_flags_mask[++i]); | 1065 | mask++; |
1066 | str += strlen(str) + 1; | ||
1067 | } while (*str); | ||
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ | 1070 | /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ |