Changeset 32708


Ignore:
Timestamp:
Jul 16, 2017, 1:04:40 PM (10 days ago)
Author:
brainslayer
Message:

Only flush IPv4 rules on IPv4 address event. Only flush IPv6 rules on IPv6 address event.

Location:
src/linux/universal
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.10/net/shortcut-fe/sfe_backport.h

    r32631 r32708  
    122122#endif
    123123
    124 /*
    125  * declare function sfe_dev_event_cb_t
    126  */
    127 typedef int (*sfe_dev_event_cb_t)(struct notifier_block *this, unsigned long event, void *ptr);
    128 
    129 /*
    130  * sfe_propagate_dev_event
    131  *     propagate ip address event as network device event
    132  */
    133 static inline int sfe_propagate_dev_event(sfe_dev_event_cb_t fn, struct notifier_block *this, unsigned long event, struct net_device *dev)
    134 {
    135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
    136        struct netdev_notifier_info info;
    137 
    138        netdev_notifier_info_init(&info, dev);
    139        return fn(this, event, &info);
    140 #else
    141        return fn(this, event, dev);
    142 #endif
    143 }
    144 
    145124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
    146125#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
  • src/linux/universal/linux-3.10/net/shortcut-fe/sfe_cm.c

    r32695 r32708  
    914914        struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
    915915
    916         switch (event) {
    917         case NETDEV_DOWN:
    918                 if (dev) {
    919                         sfe_ipv4_destroy_all_rules_for_dev(dev);
    920 #ifdef SFE_SUPPORT_IPV6
    921                         sfe_ipv6_destroy_all_rules_for_dev(dev);
    922 #endif
    923                 }
    924                 break;
    925         }
    926 
     916        if (dev && (event == NETDEV_DOWN)) {
     917                sfe_ipv4_destroy_all_rules_for_dev(dev);
     918#ifdef SFE_SUPPORT_IPV6
     919                sfe_ipv6_destroy_all_rules_for_dev(dev);
     920#endif
     921        }
    927922        return NOTIFY_DONE;
    928923}
     
    934929{
    935930        struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
    936         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     931
     932        if (dev && (event == NETDEV_DOWN)) {
     933                sfe_ipv4_destroy_all_rules_for_dev(dev);
     934        }
     935
     936        return NOTIFY_DONE;
    937937}
    938938
     
    943943{
    944944        struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
    945         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     945
     946        if (dev && (event == NETDEV_DOWN)) {
     947                sfe_ipv6_destroy_all_rules_for_dev(dev);
     948        }
     949
     950        return NOTIFY_DONE;
    946951}
    947952
  • src/linux/universal/linux-3.18/net/shortcut-fe/sfe_backport.h

    r32631 r32708  
    122122#endif
    123123
    124 /*
    125  * declare function sfe_dev_event_cb_t
    126  */
    127 typedef int (*sfe_dev_event_cb_t)(struct notifier_block *this, unsigned long event, void *ptr);
    128 
    129 /*
    130  * sfe_propagate_dev_event
    131  *     propagate ip address event as network device event
    132  */
    133 static inline int sfe_propagate_dev_event(sfe_dev_event_cb_t fn, struct notifier_block *this, unsigned long event, struct net_device *dev)
    134 {
    135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
    136        struct netdev_notifier_info info;
    137 
    138        netdev_notifier_info_init(&info, dev);
    139        return fn(this, event, &info);
    140 #else
    141        return fn(this, event, dev);
    142 #endif
    143 }
    144 
    145124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
    146125#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
  • src/linux/universal/linux-3.18/net/shortcut-fe/sfe_cm.c

    r32695 r32708  
    914914        struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
    915915
    916         switch (event) {
    917         case NETDEV_DOWN:
    918                 if (dev) {
    919                         sfe_ipv4_destroy_all_rules_for_dev(dev);
    920 #ifdef SFE_SUPPORT_IPV6
    921                         sfe_ipv6_destroy_all_rules_for_dev(dev);
    922 #endif
    923                 }
    924                 break;
    925         }
    926 
     916        if (dev && (event == NETDEV_DOWN)) {
     917                sfe_ipv4_destroy_all_rules_for_dev(dev);
     918#ifdef SFE_SUPPORT_IPV6
     919                sfe_ipv6_destroy_all_rules_for_dev(dev);
     920#endif
     921        }
    927922        return NOTIFY_DONE;
    928923}
     
    934929{
    935930        struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
    936         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     931
     932        if (dev && (event == NETDEV_DOWN)) {
     933                sfe_ipv4_destroy_all_rules_for_dev(dev);
     934        }
     935
     936        return NOTIFY_DONE;
    937937}
    938938
     
    943943{
    944944        struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
    945         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     945
     946        if (dev && (event == NETDEV_DOWN)) {
     947                sfe_ipv6_destroy_all_rules_for_dev(dev);
     948        }
     949
     950        return NOTIFY_DONE;
    946951}
    947952
  • src/linux/universal/linux-3.2/net/shortcut-fe/sfe_backport.h

    r32658 r32708  
    122122#endif
    123123
    124 /*
    125  * declare function sfe_dev_event_cb_t
    126  */
    127 typedef int (*sfe_dev_event_cb_t)(struct notifier_block *this, unsigned long event, void *ptr);
    128 
    129 /*
    130  * sfe_propagate_dev_event
    131  *     propagate ip address event as network device event
    132  */
    133 static inline int sfe_propagate_dev_event(sfe_dev_event_cb_t fn, struct notifier_block *this, unsigned long event, struct net_device *dev)
    134 {
    135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
    136        struct netdev_notifier_info info;
    137 
    138        netdev_notifier_info_init(&info, dev);
    139        return fn(this, event, &info);
    140 #else
    141        return fn(this, event, dev);
    142 #endif
    143 }
    144 
    145124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
    146125#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
  • src/linux/universal/linux-3.2/net/shortcut-fe/sfe_cm.c

    r32701 r32708  
    883883        struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
    884884
    885         switch (event) {
    886         case NETDEV_DOWN:
    887                 if (dev) {
    888                         sfe_ipv4_destroy_all_rules_for_dev(dev);
    889 #ifdef SFE_SUPPORT_IPV6
    890                         sfe_ipv6_destroy_all_rules_for_dev(dev);
    891 #endif
    892                 }
    893                 break;
    894         }
    895 
     885        if (dev && (event == NETDEV_DOWN)) {
     886                sfe_ipv4_destroy_all_rules_for_dev(dev);
     887#ifdef SFE_SUPPORT_IPV6
     888                sfe_ipv6_destroy_all_rules_for_dev(dev);
     889#endif
     890        }
    896891        return NOTIFY_DONE;
    897892}
     
    903898{
    904899        struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
    905         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     900
     901        if (dev && (event == NETDEV_DOWN)) {
     902                sfe_ipv4_destroy_all_rules_for_dev(dev);
     903        }
     904
     905        return NOTIFY_DONE;
    906906}
    907907
     
    912912{
    913913        struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
    914         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     914
     915        if (dev && (event == NETDEV_DOWN)) {
     916                sfe_ipv6_destroy_all_rules_for_dev(dev);
     917        }
     918
     919        return NOTIFY_DONE;
    915920}
    916921
  • src/linux/universal/linux-4.4/net/shortcut-fe/sfe_backport.h

    r32631 r32708  
    122122#endif
    123123
    124 /*
    125  * declare function sfe_dev_event_cb_t
    126  */
    127 typedef int (*sfe_dev_event_cb_t)(struct notifier_block *this, unsigned long event, void *ptr);
    128 
    129 /*
    130  * sfe_propagate_dev_event
    131  *     propagate ip address event as network device event
    132  */
    133 static inline int sfe_propagate_dev_event(sfe_dev_event_cb_t fn, struct notifier_block *this, unsigned long event, struct net_device *dev)
    134 {
    135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
    136        struct netdev_notifier_info info;
    137 
    138        netdev_notifier_info_init(&info, dev);
    139        return fn(this, event, &info);
    140 #else
    141        return fn(this, event, dev);
    142 #endif
    143 }
    144 
    145124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
    146125#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
  • src/linux/universal/linux-4.4/net/shortcut-fe/sfe_cm.c

    r32695 r32708  
    914914        struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
    915915
    916         switch (event) {
    917         case NETDEV_DOWN:
    918                 if (dev) {
    919                         sfe_ipv4_destroy_all_rules_for_dev(dev);
    920 #ifdef SFE_SUPPORT_IPV6
    921                         sfe_ipv6_destroy_all_rules_for_dev(dev);
    922 #endif
    923                 }
    924                 break;
    925         }
    926 
     916        if (dev && (event == NETDEV_DOWN)) {
     917                sfe_ipv4_destroy_all_rules_for_dev(dev);
     918#ifdef SFE_SUPPORT_IPV6
     919                sfe_ipv6_destroy_all_rules_for_dev(dev);
     920#endif
     921        }
    927922        return NOTIFY_DONE;
    928923}
     
    934929{
    935930        struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
    936         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     931
     932        if (dev && (event == NETDEV_DOWN)) {
     933                sfe_ipv4_destroy_all_rules_for_dev(dev);
     934        }
     935
     936        return NOTIFY_DONE;
    937937}
    938938
     
    943943{
    944944        struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
    945         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     945
     946        if (dev && (event == NETDEV_DOWN)) {
     947                sfe_ipv6_destroy_all_rules_for_dev(dev);
     948        }
     949
     950        return NOTIFY_DONE;
    946951}
    947952
  • src/linux/universal/linux-4.9/net/shortcut-fe/sfe_backport.h

    r32631 r32708  
    122122#endif
    123123
    124 /*
    125  * declare function sfe_dev_event_cb_t
    126  */
    127 typedef int (*sfe_dev_event_cb_t)(struct notifier_block *this, unsigned long event, void *ptr);
    128 
    129 /*
    130  * sfe_propagate_dev_event
    131  *     propagate ip address event as network device event
    132  */
    133 static inline int sfe_propagate_dev_event(sfe_dev_event_cb_t fn, struct notifier_block *this, unsigned long event, struct net_device *dev)
    134 {
    135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
    136        struct netdev_notifier_info info;
    137 
    138        netdev_notifier_info_init(&info, dev);
    139        return fn(this, event, &info);
    140 #else
    141        return fn(this, event, dev);
    142 #endif
    143 }
    144 
    145124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
    146125#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
  • src/linux/universal/linux-4.9/net/shortcut-fe/sfe_cm.c

    r32704 r32708  
    914914        struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
    915915
    916         switch (event) {
    917         case NETDEV_DOWN:
    918                 if (dev) {
    919                         sfe_ipv4_destroy_all_rules_for_dev(dev);
    920 #ifdef SFE_SUPPORT_IPV6
    921                         sfe_ipv6_destroy_all_rules_for_dev(dev);
    922 #endif
    923                 }
    924                 break;
    925         }
    926 
     916        if (dev && (event == NETDEV_DOWN)) {
     917                sfe_ipv4_destroy_all_rules_for_dev(dev);
     918#ifdef SFE_SUPPORT_IPV6
     919                sfe_ipv6_destroy_all_rules_for_dev(dev);
     920#endif
     921        }
    927922        return NOTIFY_DONE;
    928923}
     
    934929{
    935930        struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
    936         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     931
     932        if (dev && (event == NETDEV_DOWN)) {
     933                sfe_ipv4_destroy_all_rules_for_dev(dev);
     934        }
     935
     936        return NOTIFY_DONE;
    937937}
    938938
     
    943943{
    944944        struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
    945         return sfe_propagate_dev_event(sfe_cm_device_event, this, event, dev);
     945
     946        if (dev && (event == NETDEV_DOWN)) {
     947                sfe_ipv6_destroy_all_rules_for_dev(dev);
     948        }
     949
     950        return NOTIFY_DONE;
    946951}
    947952
Note: See TracChangeset for help on using the changeset viewer.