Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4885a504
Commit
4885a504
authored
Sep 16, 2007
by
Ed Swierk
Committed by
David S. Miller
Oct 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TAP]: Configurable interface MTU.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
0b69d4bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
drivers/net/tun.c
drivers/net/tun.c
+14
-0
No files found.
drivers/net/tun.c
View file @
4885a504
...
...
@@ -172,6 +172,18 @@ tun_net_mclist(struct net_device *dev)
}
}
#define MIN_MTU 68
#define MAX_MTU 65535
static
int
tun_net_change_mtu
(
struct
net_device
*
dev
,
int
new_mtu
)
{
if
(
new_mtu
<
MIN_MTU
||
new_mtu
+
dev
->
hard_header_len
>
MAX_MTU
)
return
-
EINVAL
;
dev
->
mtu
=
new_mtu
;
return
0
;
}
/* Initialize net device. */
static
void
tun_net_init
(
struct
net_device
*
dev
)
{
...
...
@@ -183,6 +195,7 @@ static void tun_net_init(struct net_device *dev)
dev
->
hard_header_len
=
0
;
dev
->
addr_len
=
0
;
dev
->
mtu
=
1500
;
dev
->
change_mtu
=
tun_net_change_mtu
;
/* Zero header length */
dev
->
type
=
ARPHRD_NONE
;
...
...
@@ -195,6 +208,7 @@ static void tun_net_init(struct net_device *dev)
dev
->
set_multicast_list
=
tun_net_mclist
;
ether_setup
(
dev
);
dev
->
change_mtu
=
tun_net_change_mtu
;
/* random address already created for us by tun_set_iff, use it */
memcpy
(
dev
->
dev_addr
,
tun
->
dev_addr
,
min
(
sizeof
(
tun
->
dev_addr
),
sizeof
(
dev
->
dev_addr
))
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment