Overview
Comment: | some bugs related to use_cache, etc. also a lot of cleanup. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
371d474ebc7f4ae2e14f7b6ee92151dd |
User & Date: | rmiller on 2011-03-06 23:20:20 |
Other Links: | manifest | tags |
Context
2011-03-06
| ||
23:30 | remove pbl_set_verdict. It was a waste of code lines. check-in: 49947c3157 user: rmiller tags: trunk | |
23:20 | some bugs related to use_cache, etc. also a lot of cleanup. check-in: 371d474ebc user: rmiller tags: trunk | |
17:47 | update readme check-in: d59c5b24a3 user: rmiller tags: trunk | |
Changes
Modified packetbl.c from [c4e4dc8395] to [ac69747424].
1 | 1 2 3 4 5 6 7 8 9 | - + |
|
︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - - + - - - - | pid = fork(); if (pid > 0) { exit(EXIT_SUCCESS); } if (pid < 0) { |
︙ | |||
174 175 176 177 178 179 180 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | - + - + - - - - - + + - - - + - - - + + + - - - - - - - - + + + - - + - - - - + - - - - - + - - - - - + - - - - - - - - - - + - - - - - + - - - - - - - - - + - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - + - - - - - - - - + | int packet_check_ip(const struct packet_info ip) { int retval; #ifdef USE_CACHE uint32_t ipaddr_check; uint32_t cache_hash = 0; time_t currtime; |
︙ | |||
741 742 743 744 745 746 747 748 749 750 751 752 753 754 | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | + | ce = malloc(sizeof(struct config_entry)); if (ce == NULL) { /* shouldn't happen... */ fprintf(stderr, "Failed to allocate memory for ce struct\n"); exit(EXIT_FAILURE); } ce->index = i; ce->string = (char *)strdup(setting); ce->next = NULL; #ifdef HAVE_FIREDNS blacklistlen = strlen(ce->string); if (ce->string[blacklistlen - 1] == '.') { ce->string[blacklistlen - 1] = '\0'; } |
︙ | |||
1070 1071 1072 1073 1074 1075 1076 | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | - - + + | * * ARGUMENTS: * struct packet_info *ip IP address data to check in supplied list. * struct config_entry *list List that contains data to check in against, * whitelist for example. * * RETURN VALUE: |
︙ | |||
1105 1106 1107 1108 1109 1110 1111 | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | - - - - + - - - - - - + - - + + - + + - + + + + + + + + - + - + - + - + - + | while (1) { uint32_t p = 0; p = ip_proc; p &= wltmp->cidr.processed; if (p == wltmp->cidr.ip) { |
︙ |
Modified packetbl.h from [04dd1a732b] to [0899b0d159].
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | + + + + + + + | # define PBL_SET_MODE nfq_set_mode # define PBL_COPY_PACKET NFQNL_COPY_PACKET # define PBL_ID_T u_int32_t # define PBL_ERRSTR "" #define DEBUG(x, y) if (conf.debug >= x) { printf(y "\n"); } #define INVALID_OCTET(x) x < 0 || x > 255 #define DPRINT(format, args...) if (conf.debug == 0) { \ syslog(LOG_INFO, format , ## args); \ } else { \ fprintf(stderr, format , ## args); \ } #define DPRINTQ(format, args...) if (!conf.quiet) { DPRINT(format, ## args) }; struct packet_info { uint8_t b1; uint8_t b2; uint8_t b3; uint8_t b4; |
︙ | |||
95 96 97 98 99 100 101 102 103 104 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | + - - | struct config_entry { char *string; struct config_entry *next; struct packet_info ip; struct cidr cidr; int index; }; |
︙ | |||
137 138 139 140 141 142 143 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - + - + | struct packet_cache_t { uint32_t ipaddr; time_t expires; int action; }; struct packet_cache_t *packet_cache = NULL; uint32_t packet_cache_len = USE_CACHE_DEF_LEN; |
︙ |