diff --git a/configure.ac b/configure.ac index 916900cf7b..06940e6c09 100644 --- a/configure.ac +++ b/configure.ac @@ -238,8 +238,6 @@ AC_ARG_WITH(iproute-usr-dir, [AS_HELP_STRING([--with-iproute-usr-dir=PATH_TO_CONFIG_FILES], [specify usr directory iproute2 uses for config files])]) AC_ARG_WITH(iproute-etc-dir, [AS_HELP_STRING([--with-iproute-etc-dir=PATH_TO_CONFIG_FILES], [specify etc directory iproute2 uses for config files])]) -AC_ARG_ENABLE(update-rt-addrprotos-file, - [AS_HELP_STRING([--enable-update-rt-addrprotos-file], [update iproute rt_addrprotos file if no entry for keepalived])]) AC_ARG_ENABLE(strict-config-checks, [AS_HELP_STRING([--enable-strict-config-checks], [build with strict configuration checking])]) AC_ARG_ENABLE(hardening, @@ -2795,14 +2793,6 @@ AS_IF([test .${iproute_usr_dir} != . ], add_config_opt([IPROUTE_USR_DIR=$iproute_usr_dir]) ]) -AS_IF([test .${enable_update_rt_addrprotos_file} = ."yes"], - [ - AC_DEFINE([UPDATE_RT_ADDRPROTOS_FILE], [ 1 ], [update iproute2 rt_addrprotos file]) - echo You probably do not want to use this option\; it is better to create an - echo entry in /etc/iproute2/rt_addrprotos, or add keepalived.conf with a relevant - echo entry in /etc/iproute2/rt_addrprotos.d if your version of iproute2 is \>= 6.12. - ]) - dnl - Check type of rlim_t for printf() - this check needs to be late on dnl - since _FILE_OFFSET_BITS (set when using netsnmp) alters sizeof(rlim_t) SAV_CFLAGS="$CFLAGS" @@ -3533,9 +3523,6 @@ echo "Strict config checks : ${STRICT_CONFIG}" echo "Build documentation : ${HAVE_SPHINX_BUILD}" echo "iproute usr directory : ${iproute_usr_dir}" echo "iproute etc directory : ${iproute_etc_dir}" -if test .${enable_update_rt_addrprotos_file} = .yes; then - echo "update rt_addrprotos : Yes" -fi if test ${ENABLE_STACKTRACE} = Yes; then echo "Stacktrace support : Yes" fi diff --git a/keepalived/vrrp/vrrp_daemon.c b/keepalived/vrrp/vrrp_daemon.c index c47b0822a8..6066776cfc 100644 --- a/keepalived/vrrp/vrrp_daemon.c +++ b/keepalived/vrrp/vrrp_daemon.c @@ -318,10 +318,6 @@ vrrp_terminate_phase2(int exit_status) clear_rt_names(); -#if HAVE_DECL_IFA_PROTO && defined UPDATE_RT_ADDRPROTOS_FILE - remove_created_addrprotos_file(); -#endif - if (global_data->vrrp_notify_fifo.fd != -1) notify_fifo_close(&global_data->notify_fifo, &global_data->vrrp_notify_fifo); diff --git a/lib/rttables.c b/lib/rttables.c index 1fbcac3414..c381aa0f74 100644 --- a/lib/rttables.c +++ b/lib/rttables.c @@ -68,7 +68,7 @@ #include #include #include -#if HAVE_DECL_IFA_PROTO && defined UPDATE_RT_ADDRPROTOS_FILE +#if HAVE_DECL_IFA_PROTO #include #endif #ifdef HAVE_SYS_STAT_H @@ -186,12 +186,6 @@ static LIST_HEAD_INITIALIZE(rt_scopes); static char ret_buf[11]; /* uint32_t in decimal */ -#if HAVE_DECL_IFA_PROTO && defined UPDATE_RT_ADDRPROTOS_FILE -static const char *created_addrprotos_file; -static const char *created_addrprotos_dir; -bool updated_addrprotos_file; -#endif - static void free_rt_entry(rt_entry_t *rte) { @@ -597,7 +591,6 @@ get_rttables_addrproto(uint32_t id) return get_entry(id, &rt_scopes, RT_ADDRPROTOS_FILE, rtscope_default, 255); } -#ifdef UPDATE_RT_ADDRPROTOS_FILE static void write_addrproto_config(const char *name, uint32_t val) { @@ -631,18 +624,16 @@ write_addrproto_config(const char *name, uint32_t val) sscanf(v, "%d.%d.%d", &ver_maj, &ver_min, &ver_rel); if (ver_maj >= 7 || (ver_maj == 6 && ver_min >= 12)) { dir = IPROUTE_ETC_DIR "/" RT_ADDRPROTOS_FILE ".d"; - path = IPROUTE_ETC_DIR "/" RT_ADDRPROTOS_FILE ".d/keepalived_private.conf" ; - } else if (ver_maj == 6 && ver_min >= 3) { + path = IPROUTE_ETC_DIR "/" RT_ADDRPROTOS_FILE ".d/keepalived.conf" ; + } else if (ver_maj == 6 && ver_min >= 3) path = IPROUTE_ETC_DIR "/" RT_ADDRPROTOS_FILE; - } else + else return; stat(IPROUTE_ETC_DIR, &statbuf); if (dir) { - if (!mkdir(dir, statbuf.st_mode & ~S_IFMT)) { // This may fail if the directory already exists - created_addrprotos_dir = dir; + if (!mkdir(dir, statbuf.st_mode & ~S_IFMT)) // This may fail if the directory already exists chmod(dir, statbuf.st_mode & ~S_IFMT); - } } else { /* Check if rt_addrprotos file exists */ file_exists = !stat(path, &statbuf); @@ -654,20 +645,10 @@ write_addrproto_config(const char *name, uint32_t val) if (!file_exists) chmod(path, statbuf.st_mode & ~S_IFMT & ~(S_IXUSR | S_IXGRP | S_IXOTH)); - if (dir || !file_exists) { - fputs("# File created by keepalived - feel free to remove it\n", fp); - fprintf(fp, "%u\t%s\n", val, name); - } else - fprintf(fp, "%u\t%s\t# entry added by keepalived - feel free to remove it\n", val, name); + fprintf(fp, "%u\t%s\t# added by keepalived\n", val, name); fclose(fp); - - if (!file_exists) - created_addrprotos_file = path; - else - updated_addrprotos_file = true; } -#endif bool create_rttables_addrproto(const char *name, uint8_t *id) @@ -703,31 +684,12 @@ create_rttables_addrproto(const char *name, uint8_t *id) list_add_tail(&rte->e_list, &rt_addrprotos); -#ifdef UPDATE_RT_ADDRPROTOS_FILE /* Save the entry so iproute can use it */ write_addrproto_config(name, *id); -#endif return true; } -#ifdef UPDATE_RT_ADDRPROTOS_FILE -void -remove_created_addrprotos_file(void) -{ - if (created_addrprotos_file) { - unlink(created_addrprotos_file); - - if (created_addrprotos_dir) - rmdir(created_addrprotos_dir); - } else if (updated_addrprotos_file) { - if (system("sed -i -e '/keepalived/d' " IPROUTE_ETC_DIR "/" RT_ADDRPROTOS_FILE)) { - /* Dummy to aviod unused result warning */ - } - } -} -#endif - bool find_rttables_addrproto(const char *name, uint8_t *id) { diff --git a/lib/rttables.h b/lib/rttables.h index 981b49bc16..d50e89ab1b 100644 --- a/lib/rttables.h +++ b/lib/rttables.h @@ -47,8 +47,5 @@ extern const char *get_rttables_scope(uint32_t); extern const char *get_rttables_group(uint32_t); #endif extern const char *get_rttables_rtntype(uint8_t); -#if HAVE_DECL_IFA_PROTO && defined UPDATE_RT_ADDRPROTOS_FILE -extern void remove_created_addrprotos_file(void); -#endif #endif