M7350v7_en_gpl
This commit is contained in:
16
kernel/net/core/dev.c
Normal file → Executable file
16
kernel/net/core/dev.c
Normal file → Executable file
@ -175,6 +175,13 @@ static int call_netdevice_notifiers_info(unsigned long val,
|
||||
DEFINE_RWLOCK(dev_base_lock);
|
||||
EXPORT_SYMBOL(dev_base_lock);
|
||||
|
||||
//[zhangguosong start] 2018-05-07
|
||||
/*
|
||||
*brief 对所有来自WAN的流量均设置数据包的mark字段
|
||||
*/
|
||||
#define MASK_FOR_WAN2LAN (0x00008000)
|
||||
//[zhangguosong end]
|
||||
|
||||
/* protects napi_hash addition/deletion and napi_gen_id */
|
||||
static DEFINE_SPINLOCK(napi_hash_lock);
|
||||
|
||||
@ -3412,6 +3419,14 @@ static int netif_rx_internal(struct sk_buff *skb)
|
||||
net_timestamp_check(netdev_tstamp_prequeue, skb);
|
||||
|
||||
trace_netif_rx(skb);
|
||||
|
||||
//[zhangguosong start] 2018-05-07 for mark downstream (traffic from wan interface)
|
||||
if (skb->dev && (skb->dev->priv_flags & IFF_WAN_DEV))
|
||||
{
|
||||
skb->mark |= MASK_FOR_WAN2LAN;
|
||||
}
|
||||
//[zhangguosong end]
|
||||
|
||||
#ifdef CONFIG_RPS
|
||||
WARN_ONCE(skb_cloned(skb), "Cloned packet from dev %s\n",
|
||||
skb->dev->name);
|
||||
@ -5621,6 +5636,7 @@ void dev_set_rx_mode(struct net_device *dev)
|
||||
netif_addr_unlock_bh(dev);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dev_get_flags - get flags reported to userspace
|
||||
* @dev: device
|
||||
|
44
kernel/net/core/dev_ioctl.c
Normal file → Executable file
44
kernel/net/core/dev_ioctl.c
Normal file → Executable file
@ -17,6 +17,35 @@
|
||||
* match. --pb
|
||||
*/
|
||||
|
||||
#define SIOCSIFPRIVFLAGS 0x89ba //set device priv_flags
|
||||
#define SIOCGIFPRIVFLAGS 0x89bb //get device priv_flags
|
||||
|
||||
//[zhangguosong start] 2018-06-20
|
||||
static unsigned int dev_get_privflags(const struct net_device *dev)
|
||||
{
|
||||
return dev->priv_flags;
|
||||
}
|
||||
|
||||
static unsigned int dev_change_privflags(struct net_device *dev, unsigned int flags)
|
||||
{
|
||||
int old_flags = dev->priv_flags;
|
||||
|
||||
if ((old_flags ^ flags) & IFF_WAN_DEV)
|
||||
{
|
||||
if (old_flags & IFF_WAN_DEV)
|
||||
{
|
||||
dev->priv_flags &= ~IFF_WAN_DEV;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->priv_flags |= IFF_WAN_DEV;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//[zhangguosong end]
|
||||
|
||||
static int dev_ifname(struct net *net, struct ifreq __user *arg)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
@ -115,6 +144,7 @@ static int dev_ifconf(struct net *net, char __user *arg)
|
||||
return copy_to_user(arg, &ifc, sizeof(struct ifconf)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
#define ifr_iflags ifr_ifru.ifru_ivalue /* add by zhangguosong, for traffic control module */
|
||||
/*
|
||||
* Perform the SIOCxIFxxx calls, inside rcu_read_lock()
|
||||
*/
|
||||
@ -127,6 +157,10 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm
|
||||
return -ENODEV;
|
||||
|
||||
switch (cmd) {
|
||||
//[zhangguosong start]
|
||||
case SIOCGIFPRIVFLAGS: /* Get interface priv_flags */
|
||||
ifr->ifr_iflags = dev_get_privflags(dev);
|
||||
//[zhangguosng end]
|
||||
case SIOCGIFFLAGS: /* Get interface flags */
|
||||
ifr->ifr_flags = (short) dev_get_flags(dev);
|
||||
return 0;
|
||||
@ -248,6 +282,10 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
|
||||
ops = dev->netdev_ops;
|
||||
|
||||
switch (cmd) {
|
||||
//[zhangguosong start] 2018-06-20
|
||||
case SIOCSIFPRIVFLAGS:
|
||||
return dev_change_privflags(dev, ifr->ifr_iflags);
|
||||
//[zhangguosong end]
|
||||
case SIOCSIFFLAGS: /* Set interface flags */
|
||||
return dev_change_flags(dev, ifr->ifr_flags);
|
||||
|
||||
@ -427,6 +465,9 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||
* - atomic and do not require locking.
|
||||
* - return a value
|
||||
*/
|
||||
//[zhangguosong start]
|
||||
case SIOCGIFPRIVFLAGS:
|
||||
//[zhangguosong end]
|
||||
case SIOCGIFFLAGS:
|
||||
case SIOCGIFMETRIC:
|
||||
case SIOCGIFMTU:
|
||||
@ -503,6 +544,9 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||
* - require strict serialization.
|
||||
* - do not return a value
|
||||
*/
|
||||
//[zhangguosong start] 2018-06-20
|
||||
case SIOCSIFPRIVFLAGS:
|
||||
//[zhangguosong end]
|
||||
case SIOCSIFFLAGS:
|
||||
case SIOCSIFMETRIC:
|
||||
case SIOCSIFMTU:
|
||||
|
Reference in New Issue
Block a user