oga's tools
修訂 | 8ba463f2beffb044d026eced36626c8ed2596fe2 (tree) |
---|---|
時間 | 2014-01-12 09:24:21 |
作者 | oga <hyperoga@gmai...> |
Commiter | oga |
14/01/12 V0.30 check CIDR
@@ -1,8 +1,9 @@ | ||
1 | 1 | /* |
2 | 2 | * class : IP アドレスクラスチェック |
3 | 3 | * |
4 | - * 97/09/09 by oga | |
5 | - * 13/12/08 support private check | |
4 | + * 97/09/09 V0.10 by oga | |
5 | + * 13/12/08 V0.20 support private check | |
6 | + * 14/01/12 V0.30 check CIDR | |
6 | 7 | */ |
7 | 8 | #include <stdio.h> |
8 | 9 | #include <stdlib.h> |
@@ -18,6 +19,7 @@ | ||
18 | 19 | #define CHECK_C 0xc0 |
19 | 20 | |
20 | 21 | #define PRIVATE "(private)" |
22 | +#define CIDR "(CIDR)" /* V0.30-A */ | |
21 | 23 | |
22 | 24 | |
23 | 25 | main(a,b) |
@@ -51,7 +53,12 @@ char *b[]; | ||
51 | 53 | } |
52 | 54 | if ((ad & CLASS_C) == CHECK_C) { |
53 | 55 | if (ad == 192 && ad2 == 168) private = PRIVATE; |
56 | + if (ad >= 194 && ad <= 207) private = CIDR; /* V0.30-A */ | |
54 | 57 | printf("%s is class C address %s\n", b[1], private); |
55 | 58 | } |
56 | 59 | return 0; |
57 | 60 | } |
61 | + | |
62 | +/* vim:ts=4:sw=4: | |
63 | + */ | |
64 | + |