Browse Source

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

MissValeska 9 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,7 +955,7 @@ andns_rslv(char *msg, int msglen, char *answer, int *answ_len)
955 955
         printf("andns_rslv msg %s answer %s", msg, answer);
956 956
         
957 957
         if(netsplit.netsplit_inet_mode == 1)
958
-        inet_mode (msg);
958
+            inet_mode(msg);
959 959
         
960 960
 	proto = GET_NK_BIT(msg);
961 961
 	if (proto == NK_DNS)

+ 24
- 5
src/inet.c View File

@@ -1060,10 +1060,10 @@ inet_send(int s, const void *msg, size_t len, int flags)
1060 1060
 			* it will just come back here to repeat the process as needed. */
1061 1061
 			case EMSGSIZE:
1062 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 1066
 				break;
1066
-
1067 1067
 			default:
1068 1068
 				error("inet_send: Cannot send(): %s", strerror(errno));
1069 1069
 				return err;
@@ -1113,8 +1113,9 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
1113 1113
 		switch (errno) {
1114 1114
 		case EMSGSIZE:
1115 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 1119
 			break;
1119 1120
 		case EFAULT:
1120 1121
                     /* Must be modified to accept IPv6 addresses
@@ -1172,5 +1173,23 @@ inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count)
1172 1173
 
1173 1174
 	if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
1174 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 1194
 	return err;
1176 1195
 }

+ 1
- 0
src/inet.h View File

@@ -209,5 +209,6 @@ ssize_t inet_sendto_timeout(int s, const void *msg, size_t len, int flags,
209 209
 							const struct sockaddr *to, socklen_t tolen,
210 210
 							u_int timeout);
211 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 214
 #endif							/*INET_H */

+ 1
- 1
src/mark.c View File

@@ -465,7 +465,7 @@ mark_init(int igw)
465 465
 	}
466 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 470
 	res = insert_rule(rule, &t, CHAIN_OUTPUT, 0);
471 471
 	if (res) {

+ 1
- 1
src/netsukuku.c View File

@@ -181,7 +181,7 @@ usage(void)
181 181
 		   " -k     Kills the running instance of ntkd\n"
182 182
 		   " -C	Runs the console server for Ntk-Console to connect to\n"
183 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