Skip to content

Commit 6697dab

Browse files
Martin Townsendholtmann
authored andcommitted
ieee802154: 6lowpan: ensure MTU of 1280 for 6lowpan
This patch drops the userspace accessable sysfs entry for the maximum datagram size of a 6LoWPAN fragment packet. A fragment should not have a datagram size value greater than 1280 byte. Instead of make this value configurable, we accept 1280 datagram size fragment packets only. Signed-off-by: Martin Townsend <[email protected]> Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 685d632 commit 6697dab

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

include/net/netns/ieee802154_6lowpan.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct netns_sysctl_lowpan {
1616
struct netns_ieee802154_lowpan {
1717
struct netns_sysctl_lowpan sysctl;
1818
struct netns_frags frags;
19-
int max_dsize;
2019
};
2120

2221
#endif

net/ieee802154/reassembly.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
355355
struct net *net = dev_net(skb->dev);
356356
struct lowpan_frag_info *frag_info = lowpan_cb(skb);
357357
struct ieee802154_addr source, dest;
358-
struct netns_ieee802154_lowpan *ieee802154_lowpan =
359-
net_ieee802154_lowpan(net);
360358
int err;
361359

362360
source = mac_cb(skb)->source;
@@ -366,8 +364,10 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type)
366364
if (err < 0)
367365
goto err;
368366

369-
if (frag_info->d_size > ieee802154_lowpan->max_dsize)
367+
if (frag_info->d_size > IPV6_MIN_MTU) {
368+
net_warn_ratelimited("lowpan_frag_rcv: datagram size exceeds MTU\n");
370369
goto err;
370+
}
371371

372372
fq = fq_find(net, frag_info, &source, &dest);
373373
if (fq != NULL) {
@@ -415,13 +415,6 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
415415
.mode = 0644,
416416
.proc_handler = proc_dointvec_jiffies,
417417
},
418-
{
419-
.procname = "6lowpanfrag_max_datagram_size",
420-
.data = &init_net.ieee802154_lowpan.max_dsize,
421-
.maxlen = sizeof(int),
422-
.mode = 0644,
423-
.proc_handler = proc_dointvec
424-
},
425418
{ }
426419
};
427420

@@ -458,7 +451,6 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
458451
table[1].data = &ieee802154_lowpan->frags.low_thresh;
459452
table[1].extra2 = &ieee802154_lowpan->frags.high_thresh;
460453
table[2].data = &ieee802154_lowpan->frags.timeout;
461-
table[3].data = &ieee802154_lowpan->max_dsize;
462454

463455
/* Don't export sysctls to unprivileged users */
464456
if (net->user_ns != &init_user_ns)
@@ -533,7 +525,6 @@ static int __net_init lowpan_frags_init_net(struct net *net)
533525
ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
534526
ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH;
535527
ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT;
536-
ieee802154_lowpan->max_dsize = 0xFFFF;
537528

538529
inet_frags_init_net(&ieee802154_lowpan->frags);
539530

0 commit comments

Comments
 (0)