mirror of
https://github.com/ChronosX88/netsukuku.git
synced 2024-11-22 10:12:18 +00:00
Many changes, Some possible fixes/optimisations in inet.c and the addition of inet_sendfile64
This commit is contained in:
parent
8e0c1ce00c
commit
f439b7d549
@ -955,7 +955,7 @@ andns_rslv(char *msg, int msglen, char *answer, int *answ_len)
|
|||||||
printf("andns_rslv msg %s answer %s", msg, answer);
|
printf("andns_rslv msg %s answer %s", msg, answer);
|
||||||
|
|
||||||
if(netsplit.netsplit_inet_mode == 1)
|
if(netsplit.netsplit_inet_mode == 1)
|
||||||
inet_mode (msg);
|
inet_mode(msg);
|
||||||
|
|
||||||
proto = GET_NK_BIT(msg);
|
proto = GET_NK_BIT(msg);
|
||||||
if (proto == NK_DNS)
|
if (proto == NK_DNS)
|
||||||
|
29
src/inet.c
29
src/inet.c
@ -1060,10 +1060,10 @@ inet_send(int s, const void *msg, size_t len, int flags)
|
|||||||
* it will just come back here to repeat the process as needed. */
|
* it will just come back here to repeat the process as needed. */
|
||||||
case EMSGSIZE:
|
case EMSGSIZE:
|
||||||
inet_send(s, msg, len/2, flags);
|
inet_send(s, msg, len/2, flags);
|
||||||
err=inet_send(s, (const char *)msg+(len/2),
|
err = inet_send(s, msg+(len/2), (len+1)/2);
|
||||||
len-(len/2), flags);
|
|
||||||
|
printf("%lu", err);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error("inet_send: Cannot send(): %s", strerror(errno));
|
error("inet_send: Cannot send(): %s", strerror(errno));
|
||||||
return err;
|
return err;
|
||||||
@ -1113,8 +1113,9 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
|
|||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EMSGSIZE:
|
case EMSGSIZE:
|
||||||
inet_sendto(s, msg, len/2, flags, to, tolen);
|
inet_sendto(s, msg, len/2, flags, to, tolen);
|
||||||
err=inet_sendto(s, (const char *)msg+(len/2),
|
err = inet_sendto(s, msg+(len/2), (len+1)/2, flags, to, tolen);
|
||||||
len-(len/2), flags, to, tolen);
|
|
||||||
|
printf("%lu", err);
|
||||||
break;
|
break;
|
||||||
case EFAULT:
|
case EFAULT:
|
||||||
/* Must be modified to accept IPv6 addresses
|
/* 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)
|
|||||||
|
|
||||||
if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
|
if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
|
||||||
error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
|
error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
|
||||||
|
if (err < count) {
|
||||||
|
count = count - err;
|
||||||
|
err = inet_sendfile(out_fd, in_fd, offset, count);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
inet_sendfile64(int out_fd, int in_fd, off64_t * offset, size_t count)
|
||||||
|
{
|
||||||
|
ssize_t err;
|
||||||
|
|
||||||
|
if ((err = sendfile64(out_fd, in_fd, offset, count)) == -1)
|
||||||
|
error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
|
||||||
|
if (err < count) {
|
||||||
|
count = count - err;
|
||||||
|
err = inet_sendfile64(out_fd, in_fd, offset, count);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -209,5 +209,6 @@ ssize_t inet_sendto_timeout(int s, const void *msg, size_t len, int flags,
|
|||||||
const struct sockaddr *to, socklen_t tolen,
|
const struct sockaddr *to, socklen_t tolen,
|
||||||
u_int timeout);
|
u_int timeout);
|
||||||
ssize_t inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count);
|
ssize_t inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count);
|
||||||
|
ssize_t inet_sendfile64(int out_fd, int in_fd, off64_t * offset, size_t count);
|
||||||
|
|
||||||
#endif /*INET_H */
|
#endif /*INET_H */
|
||||||
|
@ -465,7 +465,7 @@ mark_init(int igw)
|
|||||||
}
|
}
|
||||||
restore_output_rule_init(rule);
|
restore_output_rule_init(rule);
|
||||||
|
|
||||||
error("Rule in mark_init: %s", rule);
|
error("Rule in mark_init: %s", *rule);
|
||||||
|
|
||||||
res = insert_rule(rule, &t, CHAIN_OUTPUT, 0);
|
res = insert_rule(rule, &t, CHAIN_OUTPUT, 0);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -181,7 +181,7 @@ usage(void)
|
|||||||
" -k Kills the running instance of ntkd\n"
|
" -k Kills the running instance of ntkd\n"
|
||||||
" -C Runs the console server for Ntk-Console to connect to\n"
|
" -C Runs the console server for Ntk-Console to connect to\n"
|
||||||
" -e Excludes an interface from usage I.E all interfaces except this one\n"
|
" -e Excludes an interface from usage I.E all interfaces except this one\n"
|
||||||
" -n Experimental argument to implement ntk netsplit\n http://netsukuku.freaknet.org/docs/main_doc/ntk_rfc/Ntk_net_split\n");
|
" -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user