Changeset 1949
- Timestamp:
- 01/14/08 10:09:06 (12 months ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
-
fragroute/Makefile.am (modified) (1 diff)
-
fragroute/fragroute.h (modified) (2 diffs)
-
fragroute/mod.c (modified) (6 diffs)
-
tcprewrite_opts.def (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fragroute/Makefile.am
r1942 r1949 9 9 libfragroute_a_CFLAGS = -I.. -I../.. @LDNETINC@ 10 10 11 libfragroute_a_LIBS = @LDNETLIB@11 # libfragroute_a_LIBS = @LDNETLIB@ 12 12 13 13 noinst_HEADERS = bget.h mod.h pkt.h randutil.h fragroute.h argv.h \ -
trunk/src/fragroute/fragroute.h
r1941 r1949 4 4 #ifndef __FRAGROUTE_H__ 5 5 #define __FRAGROUTE_H__ 6 7 #define FRAGROUTE_ERRBUF_LEN 1024 6 8 7 9 /* Fragroute context. */ … … 19 21 // route_t *route; 20 22 // tun_t *tun; 21 char errbuf[ 1024];23 char errbuf[FRAGROUTE_ERRBUF_LEN]; 22 24 struct pktq *pktq; /* packet chain */ 23 25 }; -
trunk/src/fragroute/mod.c
r1942 r1949 86 86 TAILQ_INIT(&rules); 87 87 88 /* open the config/script file */ 88 89 if ((fp = fopen(script, "r")) == NULL) { 89 90 sprintf(errbuf, "couldn't open %s", script); 90 91 return (-1); 91 92 } 93 94 /* read the file, one line at a time... */ 92 95 for (i = 1; fgets(buf, sizeof(buf), fp) != NULL; i++) { 96 97 /* skip comments & blank lines */ 93 98 if (*buf == '#' || *buf == '\r' || *buf == '\n') 94 99 continue; 95 100 101 /* parse the line into an array */ 96 102 if ((argc = argv_create(buf, MAX_ARGS, argv)) < 1) { 97 103 sprintf(errbuf, "couldn't parse arguments (line %d)", i); … … 99 105 break; 100 106 } 107 108 /* check first keyword against modules */ 101 109 for (m = mods; *m != NULL; m++) { 102 110 if (strcasecmp((*m)->name, argv[0]) == 0) 103 111 break; 104 112 } 113 114 /* do we have a match? */ 105 115 if (*m == NULL) { 106 116 sprintf(errbuf, "unknown directive '%s' (line %d)", argv[0], i); … … 108 118 break; 109 119 } 120 121 /* allocate memory for our rule */ 110 122 if ((rule = calloc(1, sizeof(*rule))) == NULL) { 111 123 sprintf(errbuf, "calloc"); … … 115 127 rule->mod = *m; 116 128 129 /* pass the remaining args to the rule */ 117 130 if (rule->mod->open != NULL && 118 131 (rule->data = rule->mod->open(argc, argv)) == NULL) { … … 122 135 break; 123 136 } 137 /* append the rule to the rule list */ 124 138 TAILQ_INSERT_TAIL(&rules, rule, next); 125 139 } 140 141 /* close the file */ 126 142 fclose(fp); 127 143 … … 133 149 } 134 150 buf[strlen(buf) - 4] = '\0'; 135 warnx("%s", buf); 151 sprintf(errbuf, "%s", buf); 152 ret = -1; 136 153 } 137 154 return (ret); -
trunk/src/tcprewrite_opts.def
r1945 r1949 172 172 flag = { 173 173 ifdef = ENABLE_FRAGROUTE; 174 name = frag ;174 name = fragroute; 175 175 arg-type = string; 176 176 max = 1; … … 180 180 engine. See the fragroute(8) man page for more details. Important: 181 181 tcprewrite does not support the delay, echo or print commands. 182 EOText; 183 }; 184 185 186 flag = { 187 ifdef = ENABLE_FRAGROUTE; 188 name = fragdir; 189 arg-type = string; 190 max = 1; 191 descrip = "Which flows to apply fragroute to"; 192 doc = <<- EOText 193 Apply the fragroute engine to packets going c2s, s2c or both. 182 194 EOText; 183 195 };
