Browse Source

Many changes, Some possible fixes/optimisations in inet.c and the addition of inet_sendfile64

MissValeska 10 years ago
parent
commit
f439b7d549
5 changed files with 28 additions and 8 deletions
  1. 1
    1
      src/andns.c
  2. 24
    5
      src/inet.c
  3. 1
    0
      src/inet.h
  4. 1
    1
      src/mark.c
  5. 1
    1
      src/netsukuku.c

+ 1
- 1
src/andns.c View File

955
         printf("andns_rslv msg %s answer %s", msg, answer);
955
         printf("andns_rslv msg %s answer %s", msg, answer);
956
         
956
         
957
         if(netsplit.netsplit_inet_mode == 1)
957
         if(netsplit.netsplit_inet_mode == 1)
958
-        inet_mode (msg);
958
+            inet_mode(msg);
959
         
959
         
960
 	proto = GET_NK_BIT(msg);
960
 	proto = GET_NK_BIT(msg);
961
 	if (proto == NK_DNS)
961
 	if (proto == NK_DNS)

+ 24
- 5
src/inet.c View File

1060
 			* it will just come back here to repeat the process as needed. */
1060
 			* it will just come back here to repeat the process as needed. */
1061
 			case EMSGSIZE:
1061
 			case EMSGSIZE:
1062
 				inet_send(s, msg, len/2, flags);
1062
 				inet_send(s, msg, len/2, flags);
1063
-				err=inet_send(s, (const char *)msg+(len/2),
1064
-						len-(len/2), flags);
1063
+				err = inet_send(s, msg+(len/2), (len+1)/2);
1064
+                                
1065
+                                printf("%lu", err);
1065
 				break;
1066
 				break;
1066
-
1067
 			default:
1067
 			default:
1068
 				error("inet_send: Cannot send(): %s", strerror(errno));
1068
 				error("inet_send: Cannot send(): %s", strerror(errno));
1069
 				return err;
1069
 				return err;
1113
 		switch (errno) {
1113
 		switch (errno) {
1114
 		case EMSGSIZE:
1114
 		case EMSGSIZE:
1115
 				inet_sendto(s, msg, len/2, flags, to, tolen);
1115
 				inet_sendto(s, msg, len/2, flags, to, tolen);
1116
-				err=inet_sendto(s, (const char *)msg+(len/2),
1117
-						len-(len/2), flags, to, tolen);
1116
+				err = inet_sendto(s, msg+(len/2), (len+1)/2, flags, to, tolen);
1117
+                                
1118
+                                printf("%lu", err);
1118
 			break;
1119
 			break;
1119
 		case EFAULT:
1120
 		case EFAULT:
1120
                     /* Must be modified to accept IPv6 addresses
1121
                     /* Must be modified to accept IPv6 addresses
1172
 
1173
 
1173
 	if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
1174
 	if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
1174
 		error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
1175
 		error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
1176
+        if (err < count) {
1177
+                count = count - err;
1178
+                err = inet_sendfile(out_fd, in_fd, offset, count);
1179
+        }
1180
+	return err;
1181
+}
1182
+
1183
+ssize_t
1184
+inet_sendfile64(int out_fd, int in_fd, off64_t * offset, size_t count)
1185
+{
1186
+	ssize_t err;
1187
+
1188
+	if ((err = sendfile64(out_fd, in_fd, offset, count)) == -1)
1189
+		error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
1190
+        if (err < count) {
1191
+            count = count - err;
1192
+            err = inet_sendfile64(out_fd, in_fd, offset, count);
1193
+        }
1175
 	return err;
1194
 	return err;
1176
 }
1195
 }

+ 1
- 0
src/inet.h View File

209
 							const struct sockaddr *to, socklen_t tolen,
209
 							const struct sockaddr *to, socklen_t tolen,
210
 							u_int timeout);
210
 							u_int timeout);
211
 ssize_t inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count);
211
 ssize_t inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count);
212
+ssize_t inet_sendfile64(int out_fd, int in_fd, off64_t * offset, size_t count);
212
 
213
 
213
 #endif							/*INET_H */
214
 #endif							/*INET_H */

+ 1
- 1
src/mark.c View File

465
 	}
465
 	}
466
 	restore_output_rule_init(rule);
466
 	restore_output_rule_init(rule);
467
         
467
         
468
-        error("Rule in mark_init: %s", rule);
468
+        error("Rule in mark_init: %s", *rule);
469
         
469
         
470
 	res = insert_rule(rule, &t, CHAIN_OUTPUT, 0);
470
 	res = insert_rule(rule, &t, CHAIN_OUTPUT, 0);
471
 	if (res) {
471
 	if (res) {

+ 1
- 1
src/netsukuku.c View File

181
 		   " -k     Kills the running instance of ntkd\n"
181
 		   " -k     Kills the running instance of ntkd\n"
182
 		   " -C	Runs the console server for Ntk-Console to connect to\n"
182
 		   " -C	Runs the console server for Ntk-Console to connect to\n"
183
 		   " -e     Excludes an interface from usage I.E all interfaces except this one\n"
183
 		   " -e     Excludes an interface from usage I.E all interfaces except this one\n"
184
-                   " -n     Experimental argument to implement ntk netsplit\n        http://netsukuku.freaknet.org/docs/main_doc/ntk_rfc/Ntk_net_split\n");
184
+                   " -n     Experimental argument to implement ntk netsplit inet/INET or ntk/NTK\n        http://netsukuku.freaknet.org/docs/main_doc/ntk_rfc/Ntk_net_split\n");
185
 }
185
 }
186
 
186
 
187
 /*
187
 /*

Loading…
Cancel
Save