diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index faf59b02c4bf..c01511e3d0c1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -267,10 +267,6 @@ void dev_add_pack(struct packet_type *pt) | |||
267 | spin_unlock_bh(&ptype_lock); | 267 | spin_unlock_bh(&ptype_lock); |
268 | } | 268 | } |
269 | 269 | ||
270 | extern void linkwatch_run_queue(void); | ||
271 | |||
272 | |||
273 | |||
274 | /** | 270 | /** |
275 | * __dev_remove_pack - remove packet handler | 271 | * __dev_remove_pack - remove packet handler |
276 | * @pt: packet type declaration | 272 | * @pt: packet type declaration |
@@ -1009,13 +1005,22 @@ void net_disable_timestamp(void) | |||
1009 | atomic_dec(&netstamp_needed); | 1005 | atomic_dec(&netstamp_needed); |
1010 | } | 1006 | } |
1011 | 1007 | ||
1012 | static inline void net_timestamp(struct timeval *stamp) | 1008 | void __net_timestamp(struct sk_buff *skb) |
1009 | { | ||
1010 | struct timeval tv; | ||
1011 | |||
1012 | do_gettimeofday(&tv); | ||
1013 | skb_set_timestamp(skb, &tv); | ||
1014 | } | ||
1015 | EXPORT_SYMBOL(__net_timestamp); | ||
1016 | |||
1017 | static inline void net_timestamp(struct sk_buff *skb) | ||
1013 | { | 1018 | { |
1014 | if (atomic_read(&netstamp_needed)) | 1019 | if (atomic_read(&netstamp_needed)) |
1015 | do_gettimeofday(stamp); | 1020 | __net_timestamp(skb); |
1016 | else { | 1021 | else { |
1017 | stamp->tv_sec = 0; | 1022 | skb->tstamp.off_sec = 0; |
1018 | stamp->tv_usec = 0; | 1023 | skb->tstamp.off_usec = 0; |
1019 | } | 1024 | } |
1020 | } | 1025 | } |
1021 | 1026 | ||
@@ -1027,7 +1032,8 @@ static inline void net_timestamp(struct timeval *stamp) | |||
1027 | void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | 1032 | void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) |
1028 | { | 1033 | { |
1029 | struct packet_type *ptype; | 1034 | struct packet_type *ptype; |
1030 | net_timestamp(&skb->stamp); | 1035 | |
1036 | net_timestamp(skb); | ||
1031 | 1037 | ||
1032 | rcu_read_lock(); | 1038 | rcu_read_lock(); |
1033 | list_for_each_entry_rcu(ptype, &ptype_all, list) { | 1039 | list_for_each_entry_rcu(ptype, &ptype_all, list) { |
@@ -1058,7 +1064,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | |||
1058 | 1064 | ||
1059 | skb2->h.raw = skb2->nh.raw; | 1065 | skb2->h.raw = skb2->nh.raw; |
1060 | skb2->pkt_type = PACKET_OUTGOING; | 1066 | skb2->pkt_type = PACKET_OUTGOING; |
1061 | ptype->func(skb2, skb->dev, ptype); | 1067 | ptype->func(skb2, skb->dev, ptype, skb->dev); |
1062 | } | 1068 | } |
1063 | } | 1069 | } |
1064 | rcu_read_unlock(); | 1070 | rcu_read_unlock(); |
@@ -1123,8 +1129,6 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | |||
1123 | #define illegal_highdma(dev, skb) (0) | 1129 | #define illegal_highdma(dev, skb) (0) |
1124 | #endif | 1130 | #endif |
1125 | 1131 | ||
1126 | extern void skb_release_data(struct sk_buff *); | ||
1127 | |||
1128 | /* Keep head the same: replace data */ | 1132 | /* Keep head the same: replace data */ |
1129 | int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask) | 1133 | int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask) |
1130 | { | 1134 | { |
@@ -1379,8 +1383,8 @@ int netif_rx(struct sk_buff *skb) | |||
1379 | if (netpoll_rx(skb)) | 1383 | if (netpoll_rx(skb)) |
1380 | return NET_RX_DROP; | 1384 | return NET_RX_DROP; |
1381 | 1385 | ||
1382 | if (!skb->stamp.tv_sec) | 1386 | if (!skb->tstamp.off_sec) |
1383 | net_timestamp(&skb->stamp); | 1387 | net_timestamp(skb); |
1384 | 1388 | ||
1385 | /* | 1389 | /* |
1386 | * The code is rearranged so that the path is the most | 1390 | * The code is rearranged so that the path is the most |
@@ -1425,14 +1429,14 @@ int netif_rx_ni(struct sk_buff *skb) | |||
1425 | 1429 | ||
1426 | EXPORT_SYMBOL(netif_rx_ni); | 1430 | EXPORT_SYMBOL(netif_rx_ni); |
1427 | 1431 | ||
1428 | static __inline__ void skb_bond(struct sk_buff *skb) | 1432 | static inline struct net_device *skb_bond(struct sk_buff *skb) |
1429 | { | 1433 | { |
1430 | struct net_device *dev = skb->dev; | 1434 | struct net_device *dev = skb->dev; |
1431 | 1435 | ||
1432 | if (dev->master) { | 1436 | if (dev->master) |
1433 | skb->real_dev = skb->dev; | ||
1434 | skb->dev = dev->master; | 1437 | skb->dev = dev->master; |
1435 | } | 1438 | |
1439 | return dev; | ||
1436 | } | 1440 | } |
1437 | 1441 | ||
1438 | static void net_tx_action(struct softirq_action *h) | 1442 | static void net_tx_action(struct softirq_action *h) |
@@ -1482,10 +1486,11 @@ static void net_tx_action(struct softirq_action *h) | |||
1482 | } | 1486 | } |
1483 | 1487 | ||
1484 | static __inline__ int deliver_skb(struct sk_buff *skb, | 1488 | static __inline__ int deliver_skb(struct sk_buff *skb, |
1485 | struct packet_type *pt_prev) | 1489 | struct packet_type *pt_prev, |
1490 | struct net_device *orig_dev) | ||
1486 | { | 1491 | { |
1487 | atomic_inc(&skb->users); | 1492 | atomic_inc(&skb->users); |
1488 | return pt_prev->func(skb, skb->dev, pt_prev); | 1493 | return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
1489 | } | 1494 | } |
1490 | 1495 | ||
1491 | #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE) | 1496 | #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE) |
@@ -1496,7 +1501,8 @@ struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, | |||
1496 | void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); | 1501 | void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); |
1497 | 1502 | ||
1498 | static __inline__ int handle_bridge(struct sk_buff **pskb, | 1503 | static __inline__ int handle_bridge(struct sk_buff **pskb, |
1499 | struct packet_type **pt_prev, int *ret) | 1504 | struct packet_type **pt_prev, int *ret, |
1505 | struct net_device *orig_dev) | ||
1500 | { | 1506 | { |
1501 | struct net_bridge_port *port; | 1507 | struct net_bridge_port *port; |
1502 | 1508 | ||
@@ -1505,14 +1511,14 @@ static __inline__ int handle_bridge(struct sk_buff **pskb, | |||
1505 | return 0; | 1511 | return 0; |
1506 | 1512 | ||
1507 | if (*pt_prev) { | 1513 | if (*pt_prev) { |
1508 | *ret = deliver_skb(*pskb, *pt_prev); | 1514 | *ret = deliver_skb(*pskb, *pt_prev, orig_dev); |
1509 | *pt_prev = NULL; | 1515 | *pt_prev = NULL; |
1510 | } | 1516 | } |
1511 | 1517 | ||
1512 | return br_handle_frame_hook(port, pskb); | 1518 | return br_handle_frame_hook(port, pskb); |
1513 | } | 1519 | } |
1514 | #else | 1520 | #else |
1515 | #define handle_bridge(skb, pt_prev, ret) (0) | 1521 | #define handle_bridge(skb, pt_prev, ret, orig_dev) (0) |
1516 | #endif | 1522 | #endif |
1517 | 1523 | ||
1518 | #ifdef CONFIG_NET_CLS_ACT | 1524 | #ifdef CONFIG_NET_CLS_ACT |
@@ -1534,17 +1540,14 @@ static int ing_filter(struct sk_buff *skb) | |||
1534 | __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); | 1540 | __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); |
1535 | if (MAX_RED_LOOP < ttl++) { | 1541 | if (MAX_RED_LOOP < ttl++) { |
1536 | printk("Redir loop detected Dropping packet (%s->%s)\n", | 1542 | printk("Redir loop detected Dropping packet (%s->%s)\n", |
1537 | skb->input_dev?skb->input_dev->name:"??",skb->dev->name); | 1543 | skb->input_dev->name, skb->dev->name); |
1538 | return TC_ACT_SHOT; | 1544 | return TC_ACT_SHOT; |
1539 | } | 1545 | } |
1540 | 1546 | ||
1541 | skb->tc_verd = SET_TC_RTTL(skb->tc_verd,ttl); | 1547 | skb->tc_verd = SET_TC_RTTL(skb->tc_verd,ttl); |
1542 | 1548 | ||
1543 | skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS); | 1549 | skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS); |
1544 | if (NULL == skb->input_dev) { | 1550 | |
1545 | skb->input_dev = skb->dev; | ||
1546 | printk("ing_filter: fixed %s out %s\n",skb->input_dev->name,skb->dev->name); | ||
1547 | } | ||
1548 | spin_lock(&dev->ingress_lock); | 1551 | spin_lock(&dev->ingress_lock); |
1549 | if ((q = dev->qdisc_ingress) != NULL) | 1552 | if ((q = dev->qdisc_ingress) != NULL) |
1550 | result = q->enqueue(skb, q); | 1553 | result = q->enqueue(skb, q); |
@@ -1559,6 +1562,7 @@ static int ing_filter(struct sk_buff *skb) | |||
1559 | int netif_receive_skb(struct sk_buff *skb) | 1562 | int netif_receive_skb(struct sk_buff *skb) |
1560 | { | 1563 | { |
1561 | struct packet_type *ptype, *pt_prev; | 1564 | struct packet_type *ptype, *pt_prev; |
1565 | struct net_device *orig_dev; | ||
1562 | int ret = NET_RX_DROP; | 1566 | int ret = NET_RX_DROP; |
1563 | unsigned short type; | 1567 | unsigned short type; |
1564 | 1568 | ||
@@ -1566,10 +1570,13 @@ int netif_receive_skb(struct sk_buff *skb) | |||
1566 | if (skb->dev->poll && netpoll_rx(skb)) | 1570 | if (skb->dev->poll && netpoll_rx(skb)) |
1567 | return NET_RX_DROP; | 1571 | return NET_RX_DROP; |
1568 | 1572 | ||
1569 | if (!skb->stamp.tv_sec) | 1573 | if (!skb->tstamp.off_sec) |
1570 | net_timestamp(&skb->stamp); | 1574 | net_timestamp(skb); |
1575 | |||
1576 | if (!skb->input_dev) | ||
1577 | skb->input_dev = skb->dev; | ||
1571 | 1578 | ||
1572 | skb_bond(skb); | 1579 | orig_dev = skb_bond(skb); |
1573 | 1580 | ||
1574 | __get_cpu_var(netdev_rx_stat).total++; | 1581 | __get_cpu_var(netdev_rx_stat).total++; |
1575 | 1582 | ||
@@ -1590,14 +1597,14 @@ int netif_receive_skb(struct sk_buff *skb) | |||
1590 | list_for_each_entry_rcu(ptype, &ptype_all, list) { | 1597 | list_for_each_entry_rcu(ptype, &ptype_all, list) { |
1591 | if (!ptype->dev || ptype->dev == skb->dev) { | 1598 | if (!ptype->dev || ptype->dev == skb->dev) { |
1592 | if (pt_prev) | 1599 | if (pt_prev) |
1593 | ret = deliver_skb(skb, pt_prev); | 1600 | ret = deliver_skb(skb, pt_prev, orig_dev); |
1594 | pt_prev = ptype; | 1601 | pt_prev = ptype; |
1595 | } | 1602 | } |
1596 | } | 1603 | } |
1597 | 1604 | ||
1598 | #ifdef CONFIG_NET_CLS_ACT | 1605 | #ifdef CONFIG_NET_CLS_ACT |
1599 | if (pt_prev) { | 1606 | if (pt_prev) { |
1600 | ret = deliver_skb(skb, pt_prev); | 1607 | ret = deliver_skb(skb, pt_prev, orig_dev); |
1601 | pt_prev = NULL; /* noone else should process this after*/ | 1608 | pt_prev = NULL; /* noone else should process this after*/ |
1602 | } else { | 1609 | } else { |
1603 | skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd); | 1610 | skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd); |
@@ -1616,7 +1623,7 @@ ncls: | |||
1616 | 1623 | ||
1617 | handle_diverter(skb); | 1624 | handle_diverter(skb); |
1618 | 1625 | ||
1619 | if (handle_bridge(&skb, &pt_prev, &ret)) | 1626 | if (handle_bridge(&skb, &pt_prev, &ret, orig_dev)) |
1620 | goto out; | 1627 | goto out; |
1621 | 1628 | ||
1622 | type = skb->protocol; | 1629 | type = skb->protocol; |
@@ -1624,13 +1631,13 @@ ncls: | |||
1624 | if (ptype->type == type && | 1631 | if (ptype->type == type && |
1625 | (!ptype->dev || ptype->dev == skb->dev)) { | 1632 | (!ptype->dev || ptype->dev == skb->dev)) { |
1626 | if (pt_prev) | 1633 | if (pt_prev) |
1627 | ret = deliver_skb(skb, pt_prev); | 1634 | ret = deliver_skb(skb, pt_prev, orig_dev); |
1628 | pt_prev = ptype; | 1635 | pt_prev = ptype; |
1629 | } | 1636 | } |
1630 | } | 1637 | } |
1631 | 1638 | ||
1632 | if (pt_prev) { | 1639 | if (pt_prev) { |
1633 | ret = pt_prev->func(skb, skb->dev, pt_prev); | 1640 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
1634 | } else { | 1641 | } else { |
1635 | kfree_skb(skb); | 1642 | kfree_skb(skb); |
1636 | /* Jamal, now you will not able to escape explaining | 1643 | /* Jamal, now you will not able to escape explaining |