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
6d7c3216
Commit
6d7c3216
authored
Feb 06, 2004
by
Shmulik Hen
Committed by
Hideaki Yoshifuji
Feb 06, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4]: Split arp_send into arp_create and arp_xmit, export them.
parent
f002d840
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
17 deletions
+57
-17
include/net/arp.h
include/net/arp.h
+8
-0
net/ipv4/arp.c
net/ipv4/arp.c
+49
-17
No files found.
include/net/arp.h
View file @
6d7c3216
...
...
@@ -5,6 +5,8 @@
#include <linux/if_arp.h>
#include <net/neighbour.h>
#define HAVE_ARP_CREATE
extern
struct
neigh_table
arp_tbl
;
extern
void
arp_init
(
void
);
...
...
@@ -19,6 +21,12 @@ extern int arp_bind_neighbour(struct dst_entry *dst);
extern
int
arp_mc_map
(
u32
addr
,
u8
*
haddr
,
struct
net_device
*
dev
,
int
dir
);
extern
void
arp_ifdown
(
struct
net_device
*
dev
);
extern
struct
sk_buff
*
arp_create
(
int
type
,
int
ptype
,
u32
dest_ip
,
struct
net_device
*
dev
,
u32
src_ip
,
unsigned
char
*
dest_hw
,
unsigned
char
*
src_hw
,
unsigned
char
*
target_hw
);
extern
void
arp_xmit
(
struct
sk_buff
*
skb
);
extern
struct
neigh_ops
arp_broken_ops
;
#endif
/* _ARP_H */
net/ipv4/arp.c
View file @
6d7c3216
...
...
@@ -67,6 +67,10 @@
* now it is in net/core/neighbour.c.
* Krzysztof Halasa: Added Frame Relay ARP support.
* Arnaldo C. Melo : convert /proc/net/arp to seq_file
* Shmulik Hen: Split arp_send to arp_create and
* arp_xmit so intermediate drivers like
* bonding can change the skb before
* sending (e.g. insert 8021q tag).
*/
#include <linux/module.h>
...
...
@@ -487,26 +491,18 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt)
*/
/*
* Create an
d send an
arp packet. If (dest_hw == NULL), we create a broadcast
* Create an arp packet. If (dest_hw == NULL), we create a broadcast
* message.
*/
void
arp_send
(
int
type
,
int
ptype
,
u32
dest_ip
,
struct
net_device
*
dev
,
u32
src_ip
,
unsigned
char
*
dest_hw
,
unsigned
char
*
src_hw
,
unsigned
char
*
target_hw
)
struct
sk_buff
*
arp_create
(
int
type
,
int
ptype
,
u32
dest_ip
,
struct
net_device
*
dev
,
u32
src_ip
,
unsigned
char
*
dest_hw
,
unsigned
char
*
src_hw
,
unsigned
char
*
target_hw
)
{
struct
sk_buff
*
skb
;
struct
arphdr
*
arp
;
unsigned
char
*
arp_ptr
;
/*
* No arp on this interface.
*/
if
(
dev
->
flags
&
IFF_NOARP
)
return
;
/*
* Allocate a buffer
*/
...
...
@@ -514,7 +510,7 @@ void arp_send(int type, int ptype, u32 dest_ip,
skb
=
alloc_skb
(
sizeof
(
struct
arphdr
)
+
2
*
(
dev
->
addr_len
+
4
)
+
LL_RESERVED_SPACE
(
dev
),
GFP_ATOMIC
);
if
(
skb
==
NULL
)
return
;
return
NULL
;
skb_reserve
(
skb
,
LL_RESERVED_SPACE
(
dev
));
skb
->
nh
.
raw
=
skb
->
data
;
...
...
@@ -594,12 +590,46 @@ void arp_send(int type, int ptype, u32 dest_ip,
arp_ptr
+=
dev
->
addr_len
;
memcpy
(
arp_ptr
,
&
dest_ip
,
4
);
/* Send it off, maybe filter it using firewalling first. */
NF_HOOK
(
NF_ARP
,
NF_ARP_OUT
,
skb
,
NULL
,
dev
,
dev_queue_xmit
);
return
;
return
skb
;
out:
kfree_skb
(
skb
);
return
NULL
;
}
/*
* Send an arp packet.
*/
void
arp_xmit
(
struct
sk_buff
*
skb
)
{
/* Send it off, maybe filter it using firewalling first. */
NF_HOOK
(
NF_ARP
,
NF_ARP_OUT
,
skb
,
NULL
,
skb
->
dev
,
dev_queue_xmit
);
}
/*
* Create and send an arp packet.
*/
void
arp_send
(
int
type
,
int
ptype
,
u32
dest_ip
,
struct
net_device
*
dev
,
u32
src_ip
,
unsigned
char
*
dest_hw
,
unsigned
char
*
src_hw
,
unsigned
char
*
target_hw
)
{
struct
sk_buff
*
skb
;
/*
* No arp on this interface.
*/
if
(
dev
->
flags
&
IFF_NOARP
)
return
;
skb
=
arp_create
(
type
,
ptype
,
dest_ip
,
dev
,
src_ip
,
dest_hw
,
src_hw
,
target_hw
);
if
(
skb
==
NULL
)
{
return
;
}
arp_xmit
(
skb
);
}
static
void
parp_redo
(
struct
sk_buff
*
skb
)
...
...
@@ -1437,6 +1467,8 @@ static int __init arp_proc_init(void)
EXPORT_SYMBOL
(
arp_broken_ops
);
EXPORT_SYMBOL
(
arp_find
);
EXPORT_SYMBOL
(
arp_rcv
);
EXPORT_SYMBOL
(
arp_create
);
EXPORT_SYMBOL
(
arp_xmit
);
EXPORT_SYMBOL
(
arp_send
);
EXPORT_SYMBOL
(
arp_tbl
);
...
...
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