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
8549ccb7
Commit
8549ccb7
authored
Jul 18, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Manual content merge with Rusty's ISO struct initializers patch.
parents
eb1f4c38
1d086a5d
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
304 additions
and
247 deletions
+304
-247
net/appletalk/aarp.c
net/appletalk/aarp.c
+126
-105
net/appletalk/ddp.c
net/appletalk/ddp.c
+130
-128
net/appletalk/sysctl_net_atalk.c
net/appletalk/sysctl_net_atalk.c
+48
-14
No files found.
net/appletalk/aarp.c
View file @
8549ccb7
...
...
@@ -66,17 +66,29 @@ int sysctl_aarp_retransmit_limit = AARP_RETRANSMIT_LIMIT;
int
sysctl_aarp_resolve_time
=
AARP_RESOLVE_TIME
;
/* Lists of aarp entries */
/**
* struct aarp_entry - AARP entry
* @last_sent - Last time we xmitted the aarp request
* @packet_queue - Queue of frames wait for resolution
* @status - Used for proxy AARP
* expires_at - Entry expiry time
* target_addr - DDP Address
* dev - Device to use
* hwaddr - Physical i/f address of target/router
* xmit_count - When this hits 10 we give up
* next - Next entry in chain
*/
struct
aarp_entry
{
/* These first two are only used for unresolved entries */
unsigned
long
last_sent
;
/* Last time we xmitted the aarp request */
struct
sk_buff_head
packet_queue
;
/* Queue of frames wait for resolution */
int
status
;
/* Used for proxy AARP */
unsigned
long
expires_at
;
/* Entry expiry time */
struct
at_addr
target_addr
;
/* DDP Address */
struct
net_device
*
dev
;
/* Device to use */
char
hwaddr
[
6
];
/* Physical i/f address of target/router */
unsigned
short
xmit_count
;
/* When this hits 10 we give up */
struct
aarp_entry
*
next
;
/* Next entry in chain */
unsigned
long
last_sent
;
struct
sk_buff_head
packet_queue
;
int
status
;
unsigned
long
expires_at
;
struct
at_addr
target_addr
;
struct
net_device
*
dev
;
char
hwaddr
[
6
];
unsigned
short
xmit_count
;
struct
aarp_entry
*
next
;
};
/* Hashed list of resolved, unresolved and proxy entries */
...
...
@@ -371,7 +383,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
static
struct
aarp_entry
*
aarp_alloc
(
void
)
{
struct
aarp_entry
*
a
=
kmalloc
(
sizeof
(
struct
aarp_entry
),
GFP_ATOMIC
);
struct
aarp_entry
*
a
=
kmalloc
(
sizeof
(
*
a
),
GFP_ATOMIC
);
if
(
a
)
skb_queue_head_init
(
&
a
->
packet_queue
);
...
...
@@ -462,7 +474,7 @@ void aarp_probe_network(struct atalk_iface *atif)
/* Defer 1/10th */
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
HZ
/
10
);
schedule_timeout
(
HZ
/
10
);
if
(
atif
->
status
&
ATIF_PROBE_FAIL
)
break
;
...
...
@@ -472,7 +484,7 @@ void aarp_probe_network(struct atalk_iface *atif)
int
aarp_proxy_probe_network
(
struct
atalk_iface
*
atif
,
struct
at_addr
*
sa
)
{
int
hash
,
retval
=
1
;
int
hash
,
retval
=
-
EPROTONOSUPPORT
;
struct
aarp_entry
*
entry
;
unsigned
int
count
;
...
...
@@ -480,19 +492,18 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
* we don't currently support LocalTalk or PPP for proxy AARP;
* if someone wants to try and add it, have fun
*/
if
(
atif
->
dev
->
type
==
ARPHRD_LOCALTLK
)
return
-
EPROTONOSUPPORT
;
if
(
atif
->
dev
->
type
==
ARPHRD_PPP
)
return
-
EPROTONOSUPPORT
;
if
(
atif
->
dev
->
type
==
ARPHRD_LOCALTLK
||
atif
->
dev
->
type
==
ARPHRD_PPP
)
goto
out
;
/*
* create a new AARP entry with the flags set to be published --
* we need this one to hang around even if it's in use
*/
entry
=
aarp_alloc
();
retval
=
-
ENOMEM
;
if
(
!
entry
)
return
-
ENOMEM
;
goto
out
;
entry
->
expires_at
=
-
1
;
entry
->
status
=
ATIF_PROBE
;
...
...
@@ -512,7 +523,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
/* Defer 1/10th */
current
->
state
=
TASK_INTERRUPTIBLE
;
spin_unlock_bh
(
&
aarp_lock
);
schedule_timeout
(
HZ
/
10
);
schedule_timeout
(
HZ
/
10
);
spin_lock_bh
(
&
aarp_lock
);
if
(
entry
->
status
&
ATIF_PROBE_FAIL
)
...
...
@@ -522,10 +533,13 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
if
(
entry
->
status
&
ATIF_PROBE_FAIL
)
{
entry
->
expires_at
=
jiffies
-
1
;
/* free the entry */
retval
=
-
EADDRINUSE
;
/* return network full */
}
else
/* clear the probing flag */
}
else
{
/* clear the probing flag */
entry
->
status
&=
~
ATIF_PROBE
;
retval
=
1
;
}
spin_unlock_bh
(
&
aarp_lock
);
out:
return
retval
;
}
...
...
@@ -613,8 +627,7 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
a
=
__aarp_find_entry
(
unresolved
[
hash
],
dev
,
sa
);
if
(
a
)
{
/* Queue onto the unresolved queue */
skb_queue_tail
(
&
a
->
packet_queue
,
skb
);
spin_unlock_bh
(
&
aarp_lock
);
return
0
;
goto
out_unlock
;
}
/* Allocate a new entry */
...
...
@@ -647,12 +660,14 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
mod_timer
(
&
aarp_timer
,
jiffies
+
sysctl_aarp_tick_time
);
/* Now finally, it is safe to drop the lock. */
out_unlock:
spin_unlock_bh
(
&
aarp_lock
);
/* Tell the ddp layer we have taken over for this frame. */
return
0
;
sendit:
if
(
skb
->
sk
)
sendit:
if
(
skb
->
sk
)
skb
->
priority
=
skb
->
sk
->
priority
;
dev_queue_xmit
(
skb
);
return
1
;
...
...
@@ -834,9 +849,12 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
break
;
}
unlock:
spin_unlock_bh
(
&
aarp_lock
);
out1:
ret
=
1
;
out0:
kfree_skb
(
skb
);
unlock:
spin_unlock_bh
(
&
aarp_lock
);
out1:
ret
=
1
;
out0:
kfree_skb
(
skb
);
return
ret
;
}
...
...
@@ -880,81 +898,84 @@ static int aarp_get_info(char *buffer, char **start, off_t offset, int length)
{
/* we should dump all our AARP entries */
struct
aarp_entry
*
entry
;
int
len
,
ct
;
len
=
sprintf
(
buffer
,
"%-10.10s %-10.10s%-18.18s%12.12s%12.12s xmit_count status
\n
"
,
"address"
,
"device"
,
"hw addr"
,
"last_sent"
,
"expires"
);
int
ct
,
len
=
sprintf
(
buffer
,
"%-10.10s %-10.10s%-18.18s%12.12s%12.12s "
"xmit_count status
\n
"
,
"address"
,
"device"
,
"hw addr"
,
"last_sent
"
,
"expires"
);
spin_lock_bh
(
&
aarp_lock
);
for
(
ct
=
0
;
ct
<
AARP_HASH_SIZE
;
ct
++
)
{
for
(
entry
=
resolved
[
ct
];
entry
;
entry
=
entry
->
next
)
{
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
(
unsigned
int
)
ntohs
(
entry
->
target_addr
.
s_net
),
(
unsigned
int
)(
entry
->
target_addr
.
s_node
));
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
entry
->
dev
->
name
);
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
(
int
)(
entry
->
hwaddr
[
0
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
1
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
2
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
3
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
4
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
5
]
&
0x000000FF
));
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
(
unsigned
long
)
entry
->
last_sent
,
(
unsigned
long
)
entry
->
expires_at
);
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
(
unsigned
int
)
entry
->
xmit_count
);
len
+=
sprintf
(
buffer
+
len
,
" resolved
\n
"
);
len
+=
sprintf
(
buffer
+
len
,
" resolved
\n
"
);
}
}
for
(
ct
=
0
;
ct
<
AARP_HASH_SIZE
;
ct
++
)
{
for
(
entry
=
unresolved
[
ct
];
entry
;
entry
=
entry
->
next
)
{
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
(
unsigned
int
)
ntohs
(
entry
->
target_addr
.
s_net
),
(
unsigned
int
)(
entry
->
target_addr
.
s_node
));
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
entry
->
dev
->
name
);
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
(
int
)(
entry
->
hwaddr
[
0
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
1
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
2
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
3
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
4
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
5
]
&
0x000000FF
));
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
(
unsigned
long
)
entry
->
last_sent
,
(
unsigned
long
)
entry
->
expires_at
);
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
(
unsigned
int
)
entry
->
xmit_count
);
len
+=
sprintf
(
buffer
+
len
,
" unresolved
\n
"
);
len
+=
sprintf
(
buffer
+
len
,
" unresolved
\n
"
);
}
}
for
(
ct
=
0
;
ct
<
AARP_HASH_SIZE
;
ct
++
)
{
for
(
entry
=
proxies
[
ct
];
entry
;
entry
=
entry
->
next
)
{
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
len
+=
sprintf
(
buffer
+
len
,
"%6u:%-3u "
,
(
unsigned
int
)
ntohs
(
entry
->
target_addr
.
s_net
),
(
unsigned
int
)(
entry
->
target_addr
.
s_node
));
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
len
+=
sprintf
(
buffer
+
len
,
"%-10.10s"
,
entry
->
dev
->
name
);
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
len
+=
sprintf
(
buffer
+
len
,
"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
,
(
int
)(
entry
->
hwaddr
[
0
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
1
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
2
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
3
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
4
]
&
0x000000FF
),
(
int
)(
entry
->
hwaddr
[
5
]
&
0x000000FF
));
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
len
+=
sprintf
(
buffer
+
len
,
"%12lu ""%12lu "
,
(
unsigned
long
)
entry
->
last_sent
,
(
unsigned
long
)
entry
->
expires_at
);
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
len
+=
sprintf
(
buffer
+
len
,
"%10u"
,
(
unsigned
int
)
entry
->
xmit_count
);
len
+=
sprintf
(
buffer
+
len
,
" proxy
\n
"
);
len
+=
sprintf
(
buffer
+
len
,
" proxy
\n
"
);
}
}
...
...
net/appletalk/ddp.c
View file @
8549ccb7
This diff is collapsed.
Click to expand it.
net/appletalk/sysctl_net_atalk.c
View file @
8549ccb7
/*
-*- linux-c -*-
/*
* sysctl_net_atalk.c: sysctl interface to net AppleTalk subsystem.
*
* Begun April 1, 1996, Mike Shaver.
...
...
@@ -17,25 +17,59 @@ extern int sysctl_aarp_resolve_time;
#ifdef CONFIG_SYSCTL
static
ctl_table
atalk_table
[]
=
{
{
NET_ATALK_AARP_EXPIRY_TIME
,
"aarp-expiry-time"
,
&
sysctl_aarp_expiry_time
,
sizeof
(
int
),
0644
,
NULL
,
&
proc_dointvec_jiffies
},
{
NET_ATALK_AARP_TICK_TIME
,
"aarp-tick-time"
,
&
sysctl_aarp_tick_time
,
sizeof
(
int
),
0644
,
NULL
,
&
proc_dointvec_jiffies
},
{
NET_ATALK_AARP_RETRANSMIT_LIMIT
,
"aarp-retransmit-limit"
,
&
sysctl_aarp_retransmit_limit
,
sizeof
(
int
),
0644
,
NULL
,
&
proc_dointvec
},
{
NET_ATALK_AARP_RESOLVE_TIME
,
"aarp-resolve-time"
,
&
sysctl_aarp_resolve_time
,
sizeof
(
int
),
0644
,
NULL
,
&
proc_dointvec_jiffies
},
{
0
}
{
.
ctl_name
=
NET_ATALK_AARP_EXPIRY_TIME
,
.
procname
=
"aarp-expiry-time"
,
.
data
=
&
sysctl_aarp_expiry_time
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
},
{
.
ctl_name
=
NET_ATALK_AARP_TICK_TIME
,
.
procname
=
"aarp-tick-time"
,
.
data
=
&
sysctl_aarp_tick_time
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
},
{
.
ctl_name
=
NET_ATALK_AARP_RETRANSMIT_LIMIT
,
.
procname
=
"aarp-retransmit-limit"
,
.
data
=
&
sysctl_aarp_retransmit_limit
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec
,
},
{
.
ctl_name
=
NET_ATALK_AARP_RESOLVE_TIME
,
.
procname
=
"aarp-resolve-time"
,
.
data
=
&
sysctl_aarp_resolve_time
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
},
{
0
},
};
static
ctl_table
atalk_dir_table
[]
=
{
{
NET_ATALK
,
"appletalk"
,
NULL
,
0
,
0555
,
atalk_table
},
{
0
}
{
.
ctl_name
=
NET_ATALK
,
.
procname
=
"appletalk"
,
.
mode
=
0555
,
.
child
=
atalk_table
,
},
{
0
},
};
static
ctl_table
atalk_root_table
[]
=
{
{
CTL_NET
,
"net"
,
NULL
,
0
,
0555
,
atalk_dir_table
},
{
0
}
{
.
ctl_name
=
CTL_NET
,
.
procname
=
"net"
,
.
mode
=
0555
,
.
child
=
atalk_dir_table
,
},
{
0
},
};
static
struct
ctl_table_header
*
atalk_table_header
;
...
...
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