--- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -68,6 +68,7 @@ void brioctl_set(int (*hook)(struct net void __user *uarg)); int br_ioctl_call(struct net *net, struct net_bridge *br, unsigned int cmd, struct ifreq *ifr, void __user *uarg); +extern bool br_is_hairpin_enabled(struct net_device *dev); #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) int br_multicast_list_adjacent(struct net_device *dev, @@ -191,4 +192,42 @@ static inline clock_t br_get_ageing_time } #endif +/* QCA NSS ECM support - Start */ +extern struct net_device *br_port_dev_get(struct net_device *dev, + unsigned char *addr, + struct sk_buff *skb, + unsigned int cookie); +extern void br_refresh_fdb_entry(struct net_device *dev, const char *addr); +extern void br_fdb_entry_refresh(struct net_device *dev, const char *addr, __u16 vid); +extern struct net_bridge_fdb_entry *br_fdb_has_entry(struct net_device *dev, + const char *addr, + __u16 vid); +extern void br_fdb_update_register_notify(struct notifier_block *nb); +extern void br_fdb_update_unregister_notify(struct notifier_block *nb); + +typedef struct net_bridge_port *br_port_dev_get_hook_t(struct net_device *dev, + struct sk_buff *skb, + unsigned char *addr, + unsigned int cookie); +extern br_port_dev_get_hook_t __rcu *br_port_dev_get_hook; + +#define BR_FDB_EVENT_ADD 0x01 +#define BR_FDB_EVENT_DEL 0x02 + +struct br_fdb_event { + struct net_device *dev; + unsigned char addr[6]; + unsigned char is_local; + struct net_bridge *br; + struct net_device *orig_dev; +}; +extern void br_fdb_register_notify(struct notifier_block *nb); +extern void br_fdb_unregister_notify(struct notifier_block *nb); + +typedef struct net_bridge_port *br_get_dst_hook_t( + const struct net_bridge_port *src, + struct sk_buff **skb); +extern br_get_dst_hook_t __rcu *br_get_dst_hook; +/* QCA NSS ECM support - End */ + #endif --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -230,7 +230,12 @@ extern void vlan_vids_del_by_dev(struct extern bool vlan_uses_dev(const struct net_device *dev); +/* QCA NSS ECM support - Start */ +extern struct net_device *vlan_dev_next_dev(const struct net_device *dev); +/* QCA NSS ECM support - End */ + #else + static inline struct net_device * __vlan_find_dev_deep_rcu(struct net_device *real_dev, __be16 vlan_proto, u16 vlan_id) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1725,6 +1725,27 @@ enum netdev_ml_priv_type { ML_PRIV_CAN, }; +/* QCA NSS ECM support - Start */ +enum netdev_priv_flags_ext { + IFF_EXT_TUN_TAP = 1<<0, + IFF_EXT_PPP_L2TPV2 = 1<<1, + IFF_EXT_PPP_L2TPV3 = 1<<2, + IFF_EXT_PPP_PPTP = 1<<3, + IFF_EXT_GRE_V4_TAP = 1<<4, + IFF_EXT_GRE_V6_TAP = 1<<5, + IFF_EXT_IFB = 1<<6, +}; + +#define IFF_EXT_TUN_TAP IFF_EXT_TUN_TAP +#define IFF_EXT_PPP_L2TPV2 IFF_EXT_PPP_L2TPV2 +#define IFF_EXT_PPP_L2TPV3 IFF_EXT_PPP_L2TPV3 +#define IFF_EXT_PPP_PPTP IFF_EXT_PPP_PPTP +#define IFF_EXT_GRE_V4_TAP IFF_EXT_GRE_V4_TAP +#define IFF_EXT_GRE_V6_TAP IFF_EXT_GRE_V6_TAP +#define IFF_EXT_IFB IFF_EXT_IFB +/* QCA NSS ECM support - End */ + + /** * struct net_device - The DEVICE structure. * @@ -2856,6 +2877,10 @@ enum netdev_cmd { NETDEV_CVLAN_FILTER_DROP_INFO, NETDEV_SVLAN_FILTER_PUSH_INFO, NETDEV_SVLAN_FILTER_DROP_INFO, + /* QCA NSS ECM Support - Start */ + NETDEV_BR_JOIN, + NETDEV_BR_LEAVE, + /* QCA NSS ECM Support - End */ }; const char *netdev_cmd_to_name(enum netdev_cmd cmd); --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -211,6 +211,11 @@ void rt6_multipath_rebalance(struct fib6 void rt6_uncached_list_add(struct rt6_info *rt); void rt6_uncached_list_del(struct rt6_info *rt); +/* QCA NSS ECM support - Start */ +int rt6_register_notifier(struct notifier_block *nb); +int rt6_unregister_notifier(struct notifier_block *nb); +/* QCA NSS ECM support - End */ + static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb) { const struct dst_entry *dst = skb_dst(skb); --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -567,4 +567,15 @@ static inline void neigh_update_is_route *notify = 1; } } + +/* QCA NSS ECM support - Start */ +struct neigh_mac_update { + unsigned char old_mac[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; + unsigned char update_mac[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; +}; + +extern void neigh_mac_update_register_notify(struct notifier_block *nb); +extern void neigh_mac_update_unregister_notify(struct notifier_block *nb); +/* QCA NSS ECM support - End */ + #endif --- a/include/net/route.h +++ b/include/net/route.h @@ -234,6 +234,11 @@ struct rtable *rt_dst_alloc(struct net_d bool nopolicy, bool noxfrm); struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); +/* QCA NSS ECM support - Start */ +int ip_rt_register_notifier(struct notifier_block *nb); +int ip_rt_unregister_notifier(struct notifier_block *nb); +/* QCA NSS ECM support - End */ + struct in_ifaddr; void fib_add_ifaddr(struct in_ifaddr *); void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -563,4 +563,12 @@ static int __init vlan_offload_init(void return 0; } +/* QCA NSS ECM support - Start */ +struct net_device *vlan_dev_next_dev(const struct net_device *dev) +{ + return vlan_dev_priv(dev)->real_dev; +} +EXPORT_SYMBOL(vlan_dev_next_dev); +/* QCA NSS ECM support - End */ + fs_initcall(vlan_offload_init); --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -37,6 +37,35 @@ static int fdb_insert(struct net_bridge static void fdb_notify(struct net_bridge *br, const struct net_bridge_fdb_entry *, int, bool); +/* QCA NSS ECM support - Start */ +ATOMIC_NOTIFIER_HEAD(br_fdb_notifier_list); +ATOMIC_NOTIFIER_HEAD(br_fdb_update_notifier_list); + +void br_fdb_register_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_register(&br_fdb_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(br_fdb_register_notify); + +void br_fdb_unregister_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&br_fdb_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(br_fdb_unregister_notify); + +void br_fdb_update_register_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_register(&br_fdb_update_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(br_fdb_update_register_notify); + +void br_fdb_update_unregister_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&br_fdb_update_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(br_fdb_update_unregister_notify); +/* QCA NSS ECM support - End */ + int __init br_fdb_init(void) { br_fdb_cache = kmem_cache_create("bridge_fdb_cache", @@ -342,6 +371,7 @@ void br_fdb_cleanup(struct work_struct * unsigned long delay = hold_time(br); unsigned long work_delay = delay; unsigned long now = jiffies; + u8 mac_addr[6]; /* QCA NSS ECM support */ /* this part is tricky, in order to avoid blocking learning and * consequently forwarding, we rely on rcu to delete objects with @@ -368,8 +398,15 @@ void br_fdb_cleanup(struct work_struct * work_delay = min(work_delay, this_timer - now); } else { spin_lock_bh(&br->hash_lock); - if (!hlist_unhashed(&f->fdb_node)) + if (!hlist_unhashed(&f->fdb_node)) { + ether_addr_copy(mac_addr, f->key.addr.addr); fdb_delete(br, f, true); + /* QCA NSS ECM support - Start */ + atomic_notifier_call_chain( + &br_fdb_update_notifier_list, 0, + (void *)mac_addr); + /* QCA NSS ECM support - End */ + } spin_unlock_bh(&br->hash_lock); } } @@ -615,6 +652,12 @@ void br_fdb_update(struct net_bridge *br &fdb->flags))) clear_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags); + + /* QCA NSS ECM support - Start */ + atomic_notifier_call_chain( + &br_fdb_update_notifier_list, + 0, (void *)addr); + /* QCA NSS ECM support - End */ } if (unlikely(test_bit(BR_FDB_ADDED_BY_USER, &flags))) @@ -794,6 +837,25 @@ static void fdb_notify(struct net_bridge struct sk_buff *skb; int err = -ENOBUFS; + /* QCA NSS ECM support - Start */ + if (fdb->dst) { + int event; + struct br_fdb_event fdb_event; + + if (type == RTM_NEWNEIGH) + event = BR_FDB_EVENT_ADD; + else + event = BR_FDB_EVENT_DEL; + + fdb_event.dev = fdb->dst->dev; + ether_addr_copy(fdb_event.addr, fdb->key.addr.addr); + fdb_event.is_local = test_bit(BR_FDB_LOCAL, &fdb->flags); + atomic_notifier_call_chain(&br_fdb_notifier_list, + event, + (void *)&fdb_event); + } + /* QCA NSS ECM support - End */ + if (swdev_notify) br_switchdev_fdb_notify(br, fdb, type); @@ -1377,3 +1439,62 @@ void br_fdb_clear_offload(const struct n spin_unlock_bh(&p->br->hash_lock); } EXPORT_SYMBOL_GPL(br_fdb_clear_offload); + +/* QCA NSS ECM support - Start */ +/* Refresh FDB entries for bridge packets being forwarded by offload engines */ +void br_refresh_fdb_entry(struct net_device *dev, const char *addr) +{ + struct net_bridge_port *p = br_port_get_rcu(dev); + + if (!p || p->state == BR_STATE_DISABLED) + return; + + if (!is_valid_ether_addr(addr)) { + pr_info("bridge: Attempt to refresh with invalid ether address %pM\n", + addr); + return; + } + + rcu_read_lock(); + br_fdb_update(p->br, p, addr, 0, true); + rcu_read_unlock(); +} +EXPORT_SYMBOL_GPL(br_refresh_fdb_entry); + +/* Update timestamp of FDB entries for bridge packets being forwarded by offload engines */ +void br_fdb_entry_refresh(struct net_device *dev, const char *addr, __u16 vid) +{ + struct net_bridge_fdb_entry *fdb; + struct net_bridge_port *p = br_port_get_rcu(dev); + + if (!p || p->state == BR_STATE_DISABLED) + return; + + rcu_read_lock(); + fdb = fdb_find_rcu(&p->br->fdb_hash_tbl, addr, vid); + if (likely(fdb)) { + fdb->updated = jiffies; + } + rcu_read_unlock(); +} +EXPORT_SYMBOL_GPL(br_fdb_entry_refresh); + +/* Look up the MAC address in the device's bridge fdb table */ +struct net_bridge_fdb_entry *br_fdb_has_entry(struct net_device *dev, + const char *addr, __u16 vid) +{ + struct net_bridge_port *p = br_port_get_rcu(dev); + struct net_bridge_fdb_entry *fdb; + + if (!p || p->state == BR_STATE_DISABLED) + return NULL; + + rcu_read_lock(); + fdb = fdb_find_rcu(&p->br->fdb_hash_tbl, addr, vid); + rcu_read_unlock(); + + return fdb; +} +EXPORT_SYMBOL_GPL(br_fdb_has_entry); +/* QCA NSS ECM support - End */ + --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,12 @@ #include "br_private.h" +/* QCA NSS ECM support - Start */ +/* Hook for external forwarding logic */ +br_port_dev_get_hook_t __rcu *br_port_dev_get_hook __read_mostly; +EXPORT_SYMBOL_GPL(br_port_dev_get_hook); +/* QCA NSS ECM support - End */ + /* * Determine initial path cost based on speed. * using recommendations from 802.1d standard @@ -707,6 +714,8 @@ int br_add_if(struct net_bridge *br, str kobject_uevent(&p->kobj, KOBJ_ADD); + call_netdevice_notifiers(NETDEV_BR_JOIN, dev); /* QCA NSS ECM support */ + return 0; err6: @@ -742,6 +751,8 @@ int br_del_if(struct net_bridge *br, str if (!p || p->br != br) return -EINVAL; + call_netdevice_notifiers(NETDEV_BR_LEAVE, dev); /* QCA NSS ECM support */ + /* Since more than one interface can be attached to a bridge, * there still maybe an alternate path for netconsole to use; * therefore there is no reason for a NETDEV_RELEASE event. @@ -785,3 +796,75 @@ bool br_port_flag_is_set(const struct ne return p->flags & flag; } EXPORT_SYMBOL_GPL(br_port_flag_is_set); + +/* QCA NSS ECM support - Start */ +/* API to know if hairpin feature is enabled/disabled on this bridge port */ +bool br_is_hairpin_enabled(struct net_device *dev) +{ + struct net_bridge_port *port = br_port_get_check_rcu(dev); + + if (likely(port)) + return port->flags & BR_HAIRPIN_MODE; + return false; +} +EXPORT_SYMBOL_GPL(br_is_hairpin_enabled); + +/* br_port_dev_get() + * If a skb is provided, and the br_port_dev_get_hook_t hook exists, + * use that to try and determine the egress port for that skb. + * If not, or no egress port could be determined, use the given addr + * to identify the port to which it is reachable, + * returing a reference to the net device associated with that port. + * + * NOTE: Return NULL if given dev is not a bridge or the mac has no + * associated port. + */ +struct net_device *br_port_dev_get(struct net_device *dev, unsigned char *addr, + struct sk_buff *skb, + unsigned int cookie) +{ + struct net_bridge_fdb_entry *fdbe; + struct net_bridge *br; + struct net_device *netdev = NULL; + + /* Is this a bridge? */ + if (!(dev->priv_flags & IFF_EBRIDGE)) + return NULL; + + rcu_read_lock(); + + /* If the hook exists and the skb isn't NULL, try and get the port */ + if (skb) { + br_port_dev_get_hook_t *port_dev_get_hook; + + port_dev_get_hook = rcu_dereference(br_port_dev_get_hook); + if (port_dev_get_hook) { + struct net_bridge_port *pdst = + __br_get(port_dev_get_hook, NULL, dev, skb, + addr, cookie); + if (pdst) { + dev_hold(pdst->dev); + netdev = pdst->dev; + goto out; + } + } + } + + /* Either there is no hook, or can't + * determine the port to use - fall back to using FDB + */ + + br = netdev_priv(dev); + + /* Lookup the fdb entry and get reference to the port dev */ + fdbe = br_fdb_find_rcu(br, addr, 0); + if (fdbe && fdbe->dst) { + netdev = fdbe->dst->dev; /* port device */ + dev_hold(netdev); + } +out: + rcu_read_unlock(); + return netdev; +} +EXPORT_SYMBOL_GPL(br_port_dev_get); +/* QCA NSS ECM support - End */ --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -2101,4 +2101,9 @@ void br_do_proxy_suppress_arp(struct sk_ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, u16 vid, struct net_bridge_port *p, struct nd_msg *msg); struct nd_msg *br_is_nd_neigh_msg(struct sk_buff *skb, struct nd_msg *m); + +/* QCA NSS ECM support - Start */ +#define __br_get(__hook, __default, __args ...) \ + (__hook ? (__hook(__args)) : (__default)) +/* QCA NSS ECM support - End */ #endif --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1690,7 +1690,7 @@ const char *netdev_cmd_to_name(enum netd N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN) N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO) N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO) - N(PRE_CHANGEADDR) + N(PRE_CHANGEADDR) N(BR_JOIN) N(BR_LEAVE) } #undef N return "UNKNOWN_NETDEV_EVENT"; --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1211,7 +1211,21 @@ static void neigh_update_hhs(struct neig } } +/* QCA NSS ECM support - start */ +ATOMIC_NOTIFIER_HEAD(neigh_mac_update_notifier_list); +void neigh_mac_update_register_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_register(&neigh_mac_update_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(neigh_mac_update_register_notify); + +void neigh_mac_update_unregister_notify(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&neigh_mac_update_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(neigh_mac_update_unregister_notify); +/* QCA NSS ECM support - End */ /* Generic update routine. -- lladdr is new lladdr or NULL, if it is not supplied. @@ -1242,6 +1256,7 @@ static int __neigh_update(struct neighbo int notify = 0; struct net_device *dev; int update_isrouter = 0; + struct neigh_mac_update nmu; /* QCA NSS ECM support */ trace_neigh_update(neigh, lladdr, new, flags, nlmsg_pid); @@ -1256,6 +1271,8 @@ static int __neigh_update(struct neighbo new = old; goto out; } + memset(&nmu, 0, sizeof(struct neigh_mac_update)); /* QCA NSS ECM support */ + if (!(flags & NEIGH_UPDATE_F_ADMIN) && (old & (NUD_NOARP | NUD_PERMANENT))) goto out; @@ -1293,6 +1310,11 @@ static int __neigh_update(struct neighbo - compare new & old - if they are different, check override flag */ + /* QCA NSS ECM update - Start */ + memcpy(nmu.old_mac, neigh->ha, dev->addr_len); + memcpy(nmu.update_mac, lladdr, dev->addr_len); + /* QCA NSS ECM update - End */ + if ((old & NUD_VALID) && !memcmp(lladdr, neigh->ha, dev->addr_len)) lladdr = neigh->ha; @@ -1415,8 +1437,11 @@ out: if (((new ^ old) & NUD_PERMANENT) || ext_learn_change) neigh_update_gc_list(neigh); - if (notify) + if (notify) { neigh_update_notify(neigh, nlmsg_pid); + atomic_notifier_call_chain(&neigh_mac_update_notifier_list, 0, + (struct neigh_mac_update *)&nmu); /* QCA NSS ECM support */ + } trace_neigh_update_done(neigh, err); --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1206,6 +1206,9 @@ static bool fib_valid_key_len(u32 key, u static void fib_remove_alias(struct trie *t, struct key_vector *tp, struct key_vector *l, struct fib_alias *old); +/* Define route change notification chain. */ +static BLOCKING_NOTIFIER_HEAD(iproute_chain); /* QCA NSS ECM support */ + /* Caller must hold RTNL. */ int fib_table_insert(struct net *net, struct fib_table *tb, struct fib_config *cfg, struct netlink_ext_ack *extack) @@ -1398,6 +1401,9 @@ int fib_table_insert(struct net *net, st rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id, &cfg->fc_nlinfo, nlflags); succeeded: + blocking_notifier_call_chain(&iproute_chain, + RTM_NEWROUTE, fi); + return 0; out_remove_new_fa: @@ -1769,6 +1775,9 @@ int fib_table_delete(struct net *net, st if (fa_to_delete->fa_state & FA_S_ACCESSED) rt_cache_flush(cfg->fc_nlinfo.nl_net); + blocking_notifier_call_chain(&iproute_chain, + RTM_DELROUTE, fa_to_delete->fa_info); + fib_release_info(fa_to_delete->fa_info); alias_free_mem_rcu(fa_to_delete); return 0; @@ -2401,6 +2410,20 @@ void __init fib_trie_init(void) 0, SLAB_PANIC | SLAB_ACCOUNT, NULL); } +/* QCA NSS ECM support - Start */ +int ip_rt_register_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&iproute_chain, nb); +} +EXPORT_SYMBOL(ip_rt_register_notifier); + +int ip_rt_unregister_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&iproute_chain, nb); +} +EXPORT_SYMBOL(ip_rt_unregister_notifier); +/* QCA NSS ECM support - End */ + struct fib_table *fib_trie_table(u32 id, struct fib_table *alias) { struct fib_table *tb; --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1003,6 +1003,7 @@ void inet6_ifa_finish_destroy(struct ine kfree_rcu(ifp, rcu); } +EXPORT_SYMBOL(inet6_ifa_finish_destroy); static void ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp) @@ -2065,6 +2066,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(str return result; } +EXPORT_SYMBOL(ipv6_get_ifaddr); /* Gets referenced address, destroys ifaddr */ --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -650,6 +650,7 @@ void ndisc_send_ns(struct net_device *de ndisc_send_skb(skb, daddr, saddr); } +EXPORT_SYMBOL(ndisc_send_ns); void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, const struct in6_addr *daddr) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3875,6 +3875,9 @@ out_free: return ERR_PTR(err); } +/* Define route change notification chain. */ +ATOMIC_NOTIFIER_HEAD(ip6route_chain); /* QCA NSS ECM support */ + int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags, struct netlink_ext_ack *extack) { @@ -3886,6 +3889,10 @@ int ip6_route_add(struct fib6_config *cf return PTR_ERR(rt); err = __ip6_ins_rt(rt, &cfg->fc_nlinfo, extack); + if (!err) + atomic_notifier_call_chain(&ip6route_chain, + RTM_NEWROUTE, rt); + fib6_info_release(rt); return err; @@ -3907,6 +3914,9 @@ static int __ip6_del_rt(struct fib6_info err = fib6_del(rt, info); spin_unlock_bh(&table->tb6_lock); + if (!err) + atomic_notifier_call_chain(&ip6route_chain, + RTM_DELROUTE, rt); out: fib6_info_release(rt); return err; @@ -6343,6 +6353,20 @@ static int ip6_route_dev_notify(struct n return NOTIFY_OK; } +/* QCA NSS ECM support - Start */ +int rt6_register_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&ip6route_chain, nb); +} +EXPORT_SYMBOL(rt6_register_notifier); + +int rt6_unregister_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_unregister(&ip6route_chain, nb); +} +EXPORT_SYMBOL(rt6_unregister_notifier); +/* QCA NSS ECM support - End */ + /* * /proc */ --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1943,6 +1943,7 @@ static void ip6gre_tap_setup(struct net_ dev->priv_flags &= ~IFF_TX_SKB_SHARING; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + dev->priv_flags_ext |= IFF_EXT_GRE_V6_TAP; /* QCA NSS ECM Support */ netif_keep_dst(dev); } --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -1341,6 +1341,7 @@ static void ipgre_tap_setup(struct net_d dev->netdev_ops = &gre_tap_netdev_ops; dev->priv_flags &= ~IFF_TX_SKB_SHARING; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + dev->priv_flags_ext |= IFF_EXT_GRE_V4_TAP; /* QCA NSS ECM Support */ ip_tunnel_setup(dev, gre_tap_net_id); } --- a/include/linux/netfilter/nf_conntrack_proto_gre.h +++ b/include/linux/netfilter/nf_conntrack_proto_gre.h @@ -31,4 +31,36 @@ void nf_ct_gre_keymap_destroy(struct nf_ bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, struct net *net, struct nf_conntrack_tuple *tuple); + +/* QCA NSS ECM Support - Start */ +/* GRE is a mess: Four different standards */ +struct gre_hdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u16 rec:3, + srr:1, + seq:1, + key:1, + routing:1, + csum:1, + version:3, + reserved:4, + ack:1; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u16 csum:1, + routing:1, + key:1, + seq:1, + srr:1, + rec:3, + ack:1, + reserved:4, + version:3; +#else +#error "Adjust your defines" +#endif + __be16 protocol; +}; +/* QCA NSS ECM Support - End */ + + #endif /* _CONNTRACK_PROTO_GRE_H */ --- a/include/net/netfilter/nf_conntrack_timeout.h +++ b/include/net/netfilter/nf_conntrack_timeout.h @@ -123,5 +123,6 @@ static inline void nf_ct_destroy_timeout extern struct nf_ct_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name); extern void (*nf_ct_timeout_put_hook)(struct nf_ct_timeout *timeout); #endif +extern unsigned int *udp_get_timeouts(struct net *net); #endif /* _NF_CONNTRACK_TIMEOUT_H */ --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c @@ -29,10 +29,11 @@ static const unsigned int udp_timeouts[U [UDP_CT_REPLIED] = 120*HZ, }; -static unsigned int *udp_get_timeouts(struct net *net) +unsigned int *udp_get_timeouts(struct net *net) { return nf_udp_pernet(net)->timeouts; } +EXPORT_SYMBOL(udp_get_timeouts); static void udp_error_log(const struct sk_buff *skb, const struct nf_hook_state *state,