diff options
Diffstat (limited to 'net/core')
| -rw-r--r-- | net/core/dev.c | 36 | ||||
| -rw-r--r-- | net/core/filter.c | 2 | ||||
| -rw-r--r-- | net/core/link_watch.c | 2 | ||||
| -rw-r--r-- | net/core/rtnetlink.c | 4 | ||||
| -rw-r--r-- | net/core/skbuff.c | 2 | ||||
| -rw-r--r-- | net/core/sock.c | 10 |
6 files changed, 38 insertions, 18 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 563ddc28139d..956d3b006e8b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(struct sk_buff *skb) | |||
| 1454 | __net_timestamp(skb); | 1454 | __net_timestamp(skb); |
| 1455 | } | 1455 | } |
| 1456 | 1456 | ||
| 1457 | static inline bool is_skb_forwardable(struct net_device *dev, | ||
| 1458 | struct sk_buff *skb) | ||
| 1459 | { | ||
| 1460 | unsigned int len; | ||
| 1461 | |||
| 1462 | if (!(dev->flags & IFF_UP)) | ||
| 1463 | return false; | ||
| 1464 | |||
| 1465 | len = dev->mtu + dev->hard_header_len + VLAN_HLEN; | ||
| 1466 | if (skb->len <= len) | ||
| 1467 | return true; | ||
| 1468 | |||
| 1469 | /* if TSO is enabled, we don't care about the length as the packet | ||
| 1470 | * could be forwarded without being segmented before | ||
| 1471 | */ | ||
| 1472 | if (skb_is_gso(skb)) | ||
| 1473 | return true; | ||
| 1474 | |||
| 1475 | return false; | ||
| 1476 | } | ||
| 1477 | |||
| 1457 | /** | 1478 | /** |
| 1458 | * dev_forward_skb - loopback an skb to another netif | 1479 | * dev_forward_skb - loopback an skb to another netif |
| 1459 | * | 1480 | * |
| @@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
| 1477 | skb_orphan(skb); | 1498 | skb_orphan(skb); |
| 1478 | nf_reset(skb); | 1499 | nf_reset(skb); |
| 1479 | 1500 | ||
| 1480 | if (unlikely(!(dev->flags & IFF_UP) || | 1501 | if (unlikely(!is_skb_forwardable(dev, skb))) { |
| 1481 | (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) { | ||
| 1482 | atomic_long_inc(&dev->rx_dropped); | 1502 | atomic_long_inc(&dev->rx_dropped); |
| 1483 | kfree_skb(skb); | 1503 | kfree_skb(skb); |
| 1484 | return NET_RX_DROP; | 1504 | return NET_RX_DROP; |
| @@ -2071,7 +2091,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
| 2071 | u32 features; | 2091 | u32 features; |
| 2072 | 2092 | ||
| 2073 | /* | 2093 | /* |
| 2074 | * If device doesnt need skb->dst, release it right now while | 2094 | * If device doesn't need skb->dst, release it right now while |
| 2075 | * its hot in this cpu cache | 2095 | * its hot in this cpu cache |
| 2076 | */ | 2096 | */ |
| 2077 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) | 2097 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) |
| @@ -2131,7 +2151,7 @@ gso: | |||
| 2131 | nskb->next = NULL; | 2151 | nskb->next = NULL; |
| 2132 | 2152 | ||
| 2133 | /* | 2153 | /* |
| 2134 | * If device doesnt need nskb->dst, release it right now while | 2154 | * If device doesn't need nskb->dst, release it right now while |
| 2135 | * its hot in this cpu cache | 2155 | * its hot in this cpu cache |
| 2136 | */ | 2156 | */ |
| 2137 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) | 2157 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) |
| @@ -2950,8 +2970,8 @@ EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook); | |||
| 2950 | * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions | 2970 | * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions |
| 2951 | * a compare and 2 stores extra right now if we dont have it on | 2971 | * a compare and 2 stores extra right now if we dont have it on |
| 2952 | * but have CONFIG_NET_CLS_ACT | 2972 | * but have CONFIG_NET_CLS_ACT |
| 2953 | * NOTE: This doesnt stop any functionality; if you dont have | 2973 | * NOTE: This doesn't stop any functionality; if you dont have |
| 2954 | * the ingress scheduler, you just cant add policies on ingress. | 2974 | * the ingress scheduler, you just can't add policies on ingress. |
| 2955 | * | 2975 | * |
| 2956 | */ | 2976 | */ |
| 2957 | static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq) | 2977 | static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq) |
| @@ -3780,7 +3800,7 @@ static void net_rx_action(struct softirq_action *h) | |||
| 3780 | * with netpoll's poll_napi(). Only the entity which | 3800 | * with netpoll's poll_napi(). Only the entity which |
| 3781 | * obtains the lock and sees NAPI_STATE_SCHED set will | 3801 | * obtains the lock and sees NAPI_STATE_SCHED set will |
| 3782 | * actually make the ->poll() call. Therefore we avoid | 3802 | * actually make the ->poll() call. Therefore we avoid |
| 3783 | * accidently calling ->poll() when NAPI is not scheduled. | 3803 | * accidentally calling ->poll() when NAPI is not scheduled. |
| 3784 | */ | 3804 | */ |
| 3785 | work = 0; | 3805 | work = 0; |
| 3786 | if (test_bit(NAPI_STATE_SCHED, &n->state)) { | 3806 | if (test_bit(NAPI_STATE_SCHED, &n->state)) { |
| @@ -6316,7 +6336,7 @@ static void __net_exit default_device_exit(struct net *net) | |||
| 6316 | if (dev->rtnl_link_ops) | 6336 | if (dev->rtnl_link_ops) |
| 6317 | continue; | 6337 | continue; |
| 6318 | 6338 | ||
| 6319 | /* Push remaing network devices to init_net */ | 6339 | /* Push remaining network devices to init_net */ |
| 6320 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); | 6340 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); |
| 6321 | err = dev_change_net_namespace(dev, &init_net, fb_name); | 6341 | err = dev_change_net_namespace(dev, &init_net, fb_name); |
| 6322 | if (err) { | 6342 | if (err) { |
diff --git a/net/core/filter.c b/net/core/filter.c index 232b1873bb28..afb8afb066bb 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
| @@ -425,7 +425,7 @@ EXPORT_SYMBOL(sk_run_filter); | |||
| 425 | * As we dont want to clear mem[] array for each packet going through | 425 | * As we dont want to clear mem[] array for each packet going through |
| 426 | * sk_run_filter(), we check that filter loaded by user never try to read | 426 | * sk_run_filter(), we check that filter loaded by user never try to read |
| 427 | * a cell if not previously written, and we check all branches to be sure | 427 | * a cell if not previously written, and we check all branches to be sure |
| 428 | * a malicious user doesnt try to abuse us. | 428 | * a malicious user doesn't try to abuse us. |
| 429 | */ | 429 | */ |
| 430 | static int check_load_and_stores(struct sock_filter *filter, int flen) | 430 | static int check_load_and_stores(struct sock_filter *filter, int flen) |
| 431 | { | 431 | { |
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 01a1101b5936..a7b342131869 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c | |||
| @@ -129,7 +129,7 @@ static void linkwatch_schedule_work(int urgent) | |||
| 129 | if (!cancel_delayed_work(&linkwatch_work)) | 129 | if (!cancel_delayed_work(&linkwatch_work)) |
| 130 | return; | 130 | return; |
| 131 | 131 | ||
| 132 | /* Otherwise we reschedule it again for immediate exection. */ | 132 | /* Otherwise we reschedule it again for immediate execution. */ |
| 133 | schedule_delayed_work(&linkwatch_work, 0); | 133 | schedule_delayed_work(&linkwatch_work, 0); |
| 134 | } | 134 | } |
| 135 | 135 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 49f7ea5b4c75..d7c4bb4b1820 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -196,7 +196,7 @@ EXPORT_SYMBOL_GPL(__rtnl_register); | |||
| 196 | * as failure of this function is very unlikely, it can only happen due | 196 | * as failure of this function is very unlikely, it can only happen due |
| 197 | * to lack of memory when allocating the chain to store all message | 197 | * to lack of memory when allocating the chain to store all message |
| 198 | * handlers for a protocol. Meant for use in init functions where lack | 198 | * handlers for a protocol. Meant for use in init functions where lack |
| 199 | * of memory implies no sense in continueing. | 199 | * of memory implies no sense in continuing. |
| 200 | */ | 200 | */ |
| 201 | void rtnl_register(int protocol, int msgtype, | 201 | void rtnl_register(int protocol, int msgtype, |
| 202 | rtnl_doit_func doit, rtnl_dumpit_func dumpit) | 202 | rtnl_doit_func doit, rtnl_dumpit_func dumpit) |
| @@ -1440,7 +1440,7 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, | |||
| 1440 | errout: | 1440 | errout: |
| 1441 | if (err < 0 && modified && net_ratelimit()) | 1441 | if (err < 0 && modified && net_ratelimit()) |
| 1442 | printk(KERN_WARNING "A link change request failed with " | 1442 | printk(KERN_WARNING "A link change request failed with " |
| 1443 | "some changes comitted already. Interface %s may " | 1443 | "some changes committed already. Interface %s may " |
| 1444 | "have been left with an inconsistent configuration, " | 1444 | "have been left with an inconsistent configuration, " |
| 1445 | "please check.\n", dev->name); | 1445 | "please check.\n", dev->name); |
| 1446 | 1446 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 801dd08908f9..7ebeed0a877c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -2267,7 +2267,7 @@ EXPORT_SYMBOL(skb_prepare_seq_read); | |||
| 2267 | * of bytes already consumed and the next call to | 2267 | * of bytes already consumed and the next call to |
| 2268 | * skb_seq_read() will return the remaining part of the block. | 2268 | * skb_seq_read() will return the remaining part of the block. |
| 2269 | * | 2269 | * |
| 2270 | * Note 1: The size of each block of data returned can be arbitary, | 2270 | * Note 1: The size of each block of data returned can be arbitrary, |
| 2271 | * this limitation is the cost for zerocopy seqeuental | 2271 | * this limitation is the cost for zerocopy seqeuental |
| 2272 | * reads of potentially non linear data. | 2272 | * reads of potentially non linear data. |
| 2273 | * | 2273 | * |
diff --git a/net/core/sock.c b/net/core/sock.c index 7dfed792434d..6e819780c232 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -215,7 +215,7 @@ __u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX; | |||
| 215 | __u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX; | 215 | __u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX; |
| 216 | __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; | 216 | __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; |
| 217 | 217 | ||
| 218 | /* Maximal space eaten by iovec or ancilliary data plus some space */ | 218 | /* Maximal space eaten by iovec or ancillary data plus some space */ |
| 219 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); | 219 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); |
| 220 | EXPORT_SYMBOL(sysctl_optmem_max); | 220 | EXPORT_SYMBOL(sysctl_optmem_max); |
| 221 | 221 | ||
| @@ -1175,7 +1175,7 @@ static void __sk_free(struct sock *sk) | |||
| 1175 | void sk_free(struct sock *sk) | 1175 | void sk_free(struct sock *sk) |
| 1176 | { | 1176 | { |
| 1177 | /* | 1177 | /* |
| 1178 | * We substract one from sk_wmem_alloc and can know if | 1178 | * We subtract one from sk_wmem_alloc and can know if |
| 1179 | * some packets are still in some tx queue. | 1179 | * some packets are still in some tx queue. |
| 1180 | * If not null, sock_wfree() will call __sk_free(sk) later | 1180 | * If not null, sock_wfree() will call __sk_free(sk) later |
| 1181 | */ | 1181 | */ |
| @@ -1185,10 +1185,10 @@ void sk_free(struct sock *sk) | |||
| 1185 | EXPORT_SYMBOL(sk_free); | 1185 | EXPORT_SYMBOL(sk_free); |
| 1186 | 1186 | ||
| 1187 | /* | 1187 | /* |
| 1188 | * Last sock_put should drop referrence to sk->sk_net. It has already | 1188 | * Last sock_put should drop reference to sk->sk_net. It has already |
| 1189 | * been dropped in sk_change_net. Taking referrence to stopping namespace | 1189 | * been dropped in sk_change_net. Taking reference to stopping namespace |
| 1190 | * is not an option. | 1190 | * is not an option. |
| 1191 | * Take referrence to a socket to remove it from hash _alive_ and after that | 1191 | * Take reference to a socket to remove it from hash _alive_ and after that |
| 1192 | * destroy it in the context of init_net. | 1192 | * destroy it in the context of init_net. |
| 1193 | */ | 1193 | */ |
| 1194 | void sk_release_kernel(struct sock *sk) | 1194 | void sk_release_kernel(struct sock *sk) |
