X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=patches%2F100-no_forwarding_override.patch;h=16658e30bd19d678cbfe967fcfd0055c49341c1e;hb=9b553c445188532b8fa4a074880d861c93ac87ce;hp=1ef2552f7b38a294a7ca82470f13644e1ec4ee90;hpb=49d9c46bfb2ce170083ad2357f205bed55fd75fd;p=lede-routing%2F.git diff --git a/patches/100-no_forwarding_override.patch b/patches/100-no_forwarding_override.patch index 1ef2552..16658e3 100644 --- a/patches/100-no_forwarding_override.patch +++ b/patches/100-no_forwarding_override.patch @@ -1,34 +1,29 @@ --- a/src/linux/net.c +++ b/src/linux/net.c -@@ -107,6 +107,7 @@ bind_socket_to_device(int sock, char *de - int - enable_ip_forwarding(int version) - { +@@ -174,11 +174,13 @@ static bool is_at_least_linuxkernel_2_6_ + */ + void + net_os_set_global_ifoptions(void) { +#if 0 - FILE *proc_fwd; - const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; - -@@ -142,6 +143,7 @@ enable_ip_forwarding(int version) - } - fclose(proc_fwd); + if (writeToProc(olsr_cnf->ip_version == AF_INET ? PROC_IPFORWARD_V4 : PROC_IPFORWARD_V6, &orig_fwd_state, '1')) { + OLSR_PRINTF(1, "Warning, could not enable IP forwarding!\n" + "you should manually ensure that IP forwarding is enabled!\n\n"); + olsr_startup_sleep(3); } +#endif - return 1; - } -@@ -268,6 +270,7 @@ restore_settings(int version) + if (olsr_cnf->smart_gw_active) { + char procfile[FILENAME_MAX]; +@@ -273,10 +275,12 @@ net_os_restore_ifoptions(void) + OLSR_PRINTF(1, "Restoring network state\n"); - /* Restore IP forwarding to "off" */ +#if 0 - if (orig_fwd_state == '0') { - const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; - FILE *proc_fd; -@@ -280,6 +283,7 @@ restore_settings(int version) - fclose(proc_fd); - } + /* Restore IP forwarding to "off" */ + if (writeToProc(olsr_cnf->ip_version == AF_INET ? PROC_IPFORWARD_V4 : PROC_IPFORWARD_V6, NULL, orig_fwd_state)) { + OLSR_PRINTF(1, "Error, could not restore ip_forward settings\n"); } +#endif - /* Restore global ICMP redirect setting */ - if (orig_global_redirect_state != '0') { + if (olsr_cnf->smart_gw_active && (olsr_cnf->ip_version == AF_INET || olsr_cnf->use_niit)) { + /* Generate the procfile name */