static void blog_skip_ppp_multicast(struct sk_buff *skb, const unsigned char *dest) { unsigned short usProtocol; unsigned short usProtocol1; __u32 *usMulticastIp; if(!is_multicast_ether_addr(dest) ) { usProtocol = ((u16 *) skb->data)[-1]; usProtocol1 = skb->data[PPPOE_UDPPROTOID_OFFSET]; usMulticastIp = (__u32*)(skb->data + PPPOE_UDPADDR_OFFSET); if((usProtocol == __constant_htons(ETH_P_PPP_SES)) && (usProtocol1 == IPPROTO_UDP)) { if(MULTICAST((*usMulticastIp))) { blog_skip(skb); } } } }
static inline void dpi_result_update( struct sk_buff *skb, struct sw_struct *param ) { uint32_t behinst; if (param->type & SW_APP) { /* * application classification result. */ uint32_t ct_appid; #if 0 behinst = appdb_get_behinst_id(param->u.s.app.cat_id, param->u.s.app.app_id, param->u.s.app.beh_id); #else behinst = appdb_get_appinst_id(param->u.s.app.cat_id, param->u.s.app.app_id); #endif ct_appid = conntrack_get_appid(skb); if (ct_appid != behinst) { if (appdb_beh2appinst(behinst) != appdb_beh2appinst(ct_appid)) { /* app id of this ctk entry is changed. Add a resync bit. */ dpi_print("appid: from 0x%08x to 0x%08x", ct_appid, behinst); } conntrack_set_appid(skb, behinst); } conntrack_set_dpi_status(skb, APPID_STATUS_IDENTIFIED); if (param->flags & SW_FG_FINAL) { conntrack_set_dpi_status(skb, APPID_STATUS_FINAL); } #ifdef DPI_URL_RECORD /* url record */ if (param->u.s.url.domain && param->u.s.url.domain_len > 0) { if (param->u.s.url.domain_len > URLINFO_MAX_HOST_LEN) { printk("URL<%s> is greater than %d\n", param->u.s.url.domain, param->u.s.url.domain_len); } else { UrlInfoEntry_t url; uint16_t url_idx; url.hostlen = param->u.s.url.domain_len; strncpy(url.host, param->u.s.url.domain, param->u.s.url.domain_len); url_idx = urlinfo_lookup(&url); if (url_idx != URLINFO_IX_INVALID) conntrack_set_urlid(skb, url_idx); else dpi_print("fail to alloc urlidx?"); } } #if 0 /* Now we only record host. We may record more in the future */ if (param->u.s.url.path && param->u.s.url.path_len > 0) { char url[1024]={0}; strncpy(url, param->u.s.url.path, param->u.s.url.path_len); printk("!!path(%d): %s\n", param->u.s.url.path_len, url); } if (param->u.s.url.referer && param->u.s.url.referer_len > 0) { char url[1024]={0}; strncpy(url, param->u.s.url.referer, param->u.s.url.referer_len); printk("##referer(%d): %s\n\n", param->u.s.url.referer_len, url); } #endif #endif #if 0 if ((param->flags & SW_FG_NOMORE) || conntrack_max_dpi_pkt((struct nf_conn *)skb->nfct, DPI_MAX_PKT)) #else if (param->flags & SW_FG_NOMORE) #endif { conntrack_set_dpi_status(skb, APPID_STATUS_NOMORE); dpi_print(" Cat:%u(%s) App:%u(%s) Beh:%u(%s)\n" " Final<%d> Nomore<%d> NOTIA<%d> APPID<%u> status<%08x>", param->u.s.app.cat_id, param->u.s.app.cat_name, param->u.s.app.app_id, param->u.s.app.app_name, param->u.s.app.beh_id, param->u.s.app.beh_name, (param->flags & SW_FG_FINAL), (param->flags & SW_FG_NOMORE), (param->flags & SW_FG_NOTIA), ((struct nf_conn *)skb->nfct)->dpi.app_id, ntohl(((struct nf_conn *)skb->nfct)->dpi.flags)); } else { #if defined(CONFIG_BCM_KF_BLOG) blog_skip(skb); #endif } } else { if (!conntrack_get_dpi_status(skb, APPID_STATUS_IDENTIFIED)) { /* * Unknown app. */ dpi_print("unknown app"); conntrack_set_appid(skb, appdb_get_unknown_behinst_id()); } #if 0 if ((param->flags & SW_FG_NOTIA) || (param->flags & SW_FG_NOMORE) || conntrack_max_dpi_pkt((struct nf_conn *)skb->nfct, DPI_MAX_PKT)) #else if ((param->flags & SW_FG_NOTIA) || (param->flags & SW_FG_NOMORE)) #endif { conntrack_set_dpi_status(skb, APPID_STATUS_NOMORE); dpi_print(" App NOMORE: APPID<%u> status<%08x>", ((struct nf_conn *)skb->nfct)->dpi.app_id, ntohl(((struct nf_conn *)skb->nfct)->dpi.flags)); } else { #if defined(CONFIG_BCM_KF_BLOG) blog_skip(skb); #endif } } devid_fw_handle(skb, param); }