Commit 8c8b9504 authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/network-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents d498eb57 8b7468f3
This diff is collapsed.
......@@ -371,13 +371,8 @@ struct he_vcc
int rc_index;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
struct wait_queue *rx_waitq;
atruct wait_queue *tx_waitq;
#else
wait_queue_head_t rx_waitq;
wait_queue_head_t tx_waitq;
#endif
};
#define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data))
......
......@@ -57,7 +57,9 @@
#define NP_IPV6 1 /* Internet Protocol V6 */
#define NP_IPX 2 /* IPX protocol */
#define NP_AT 3 /* Appletalk protocol */
#define NUM_NP 4 /* Number of NPs. */
#define NP_MPLS_UC 4 /* MPLS unicast */
#define NP_MPLS_MC 5 /* MPLS multicast */
#define NUM_NP 6 /* Number of NPs. */
#define MPHDRLEN 6 /* multilink protocol header length */
#define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */
......@@ -281,6 +283,10 @@ static inline int proto_to_npindex(int proto)
return NP_IPX;
case PPP_AT:
return NP_AT;
case PPP_MPLS_UC:
return NP_MPLS_UC;
case PPP_MPLS_MC:
return NP_MPLS_MC;
}
return -EINVAL;
}
......@@ -291,6 +297,8 @@ static const int npindex_to_proto[NUM_NP] = {
PPP_IPV6,
PPP_IPX,
PPP_AT,
PPP_MPLS_UC,
PPP_MPLS_MC,
};
/* Translates an ethertype into an NP index */
......@@ -306,6 +314,10 @@ static inline int ethertype_to_npindex(int ethertype)
case ETH_P_PPPTALK:
case ETH_P_ATALK:
return NP_AT;
case ETH_P_MPLS_UC:
return NP_MPLS_UC;
case ETH_P_MPLS_MC:
return NP_MPLS_MC;
}
return -1;
}
......@@ -316,6 +328,8 @@ static const int npindex_to_ethertype[NUM_NP] = {
ETH_P_IPV6,
ETH_P_IPX,
ETH_P_PPPTALK,
ETH_P_MPLS_UC,
ETH_P_MPLS_MC,
};
/*
......
......@@ -16,7 +16,6 @@ extern int dmascc_init(void);
extern int arcnet_init(void);
extern int scc_enet_init(void);
extern int fec_enet_init(void);
extern int dlci_setup(void);
extern int sdla_setup(void);
extern int sdla_c_setup(void);
extern int comx_init(void);
......@@ -51,9 +50,6 @@ static struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_DMASCC)
{dmascc_init, 0},
#endif
#if defined(CONFIG_DLCI)
{dlci_setup, 0},
#endif
#if defined(CONFIG_SDLA)
{sdla_c_setup, 0},
#endif
......
......@@ -539,6 +539,8 @@ static void init_dev(struct net_device *dev, u_long iobase)
dev->header_cache_update = NULL; /* not supported */
dev->change_mtu = NULL; /* set in fddi_setup() */
SET_MODULE_OWNER(dev);
/* Initialize remaining device structure information */
fddi_setup(dev);
} // init_device
......@@ -791,8 +793,6 @@ static int skfp_open(struct net_device *dev)
smt_online(smc, 1);
STI_FBI();
MOD_INC_USE_COUNT;
/* Clear local multicast address tables */
mac_clear_multicast(smc);
......@@ -854,8 +854,6 @@ static int skfp_close(struct net_device *dev)
dev_kfree_skb(skb);
}
MOD_DEC_USE_COUNT;
return (0);
} // skfp_close
......
......@@ -37,6 +37,7 @@
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/init.h>
......@@ -577,9 +578,10 @@ int dlci_init(struct net_device *dev)
return(0);
}
int __init dlci_setup(void)
int __init init_dlci(void)
{
int i;
dlci_ioctl_set(dlci_ioctl);
printk("%s.\n", version);
......@@ -589,25 +591,16 @@ int __init dlci_setup(void)
for(i=0;i<sizeof(basename) / sizeof(char *);i++)
basename[i] = NULL;
return(0);
return 0;
}
#ifdef MODULE
extern int (*dlci_ioctl_hook)(unsigned int, void *);
int init_module(void)
void __exit dlci_exit(void)
{
dlci_ioctl_hook = dlci_ioctl;
return(dlci_setup());
dlci_ioctl_set(NULL);
}
void cleanup_module(void)
{
dlci_ioctl_hook = NULL;
}
#endif /* MODULE */
module_init(init_dlci);
module_exit(dlci_exit);
MODULE_AUTHOR("Mike McLagan");
MODULE_DESCRIPTION("Frame Relay DLCI layer");
......
......@@ -61,6 +61,8 @@
#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
* over Ethernet
......
......@@ -192,7 +192,7 @@ struct frad_local
int register_frad(const char *name);
int unregister_frad(const char *name);
extern int (*dlci_ioctl_hook)(unsigned int, void *);
extern void dlci_ioctl_set(int (*hook)(unsigned int, void *));
#endif /* __KERNEL__ */
......
......@@ -74,12 +74,15 @@
#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */
#define PPP_COMP 0xfd /* compressed packet */
#define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */
#define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
#define PPP_IPXCP 0x802b /* IPX Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */
#define PPP_CCP 0x80fd /* Compression Control Protocol */
#define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
......
......@@ -201,9 +201,10 @@ enum rtattr_type_t
RTA_FLOW,
RTA_CACHEINFO,
RTA_SESSION,
RTA_HOPLIMIT,
};
#define RTA_MAX RTA_SESSION
#define RTA_MAX RTA_HOPLIMIT
#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
......
#ifndef _NET_DN_FIB_H
#define _NET_DN_FIB_H
/* WARNING: The ordering of these elements must match ordering
* of RTA_* rtnetlink attribute numbers.
*/
struct dn_kern_rta
{
void *rta_dst;
......@@ -13,8 +16,10 @@ struct dn_kern_rta
struct rtattr *rta_mx;
struct rtattr *rta_mp;
unsigned char *rta_protoinfo;
unsigned char *rta_flow;
u32 *rta_flow;
struct rta_cacheinfo *rta_ci;
struct rta_session *rta_sess;
u8 *rta_hoplimit;
};
struct dn_fib_res {
......
......@@ -163,10 +163,12 @@ extern int fib6_walk_continue(struct fib6_walker_t *w);
extern int fib6_add(struct fib6_node *root,
struct rt6_info *rt,
struct nlmsghdr *nlh);
struct nlmsghdr *nlh,
void *rtattr);
extern int fib6_del(struct rt6_info *rt,
struct nlmsghdr *nlh);
struct nlmsghdr *nlh,
void *rtattr);
extern void inet6_rt_notify(int event, struct rt6_info *rt,
struct nlmsghdr *nlh);
......
......@@ -38,9 +38,11 @@ extern void ip6_route_cleanup(void);
extern int ipv6_route_ioctl(unsigned int cmd, void *arg);
extern int ip6_route_add(struct in6_rtmsg *rtmsg,
struct nlmsghdr *);
struct nlmsghdr *,
void *rtattr);
extern int ip6_del_rt(struct rt6_info *,
struct nlmsghdr *);
struct nlmsghdr *,
void *rtattr);
extern int ip6_rt_addr_add(struct in6_addr *addr,
struct net_device *dev);
......
......@@ -20,6 +20,9 @@
#include <net/flow.h>
#include <linux/seq_file.h>
/* WARNING: The ordering of these elements must match ordering
* of RTA_* rtnetlink attribute numbers.
*/
struct kern_rta
{
void *rta_dst;
......@@ -32,8 +35,10 @@ struct kern_rta
struct rtattr *rta_mx;
struct rtattr *rta_mp;
unsigned char *rta_protoinfo;
unsigned char *rta_flow;
u32 *rta_flow;
struct rta_cacheinfo *rta_ci;
struct rta_session *rta_sess;
u8 *rta_hoplimit;
};
struct fib_nh
......
......@@ -27,8 +27,6 @@
#include <asm/uaccess.h>
#include <net/compat.h>
#define AA(__x) ((unsigned long)(__x))
static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
struct compat_iovec *uiov32,
int niov)
......@@ -393,31 +391,27 @@ static int do_set_attach_filter(int fd, int level, int optname,
struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval;
struct sock_fprog kfprog;
mm_segment_t old_fs;
compat_uptr_t uptr;
unsigned int fsize;
int ret;
compat_uptr_t ptr;
if (!access_ok(VERIFY_READ, fprog32, sizeof(*fprog32)) ||
__get_user(kfprog.len, &fprog32->len) ||
__get_user(uptr, &fprog32->filter))
__get_user(ptr, &fprog32->filter))
return -EFAULT;
kfprog.filter = compat_ptr(ptr);
fsize = kfprog.len * sizeof(struct sock_filter);
kfprog.filter = (struct sock_filter *)kmalloc(fsize, GFP_KERNEL);
if (kfprog.filter == NULL)
return -ENOMEM;
if (copy_from_user(kfprog.filter, compat_ptr(uptr), fsize)) {
kfree(kfprog.filter);
if (kfprog.len * sizeof(struct sock_filter) < kfprog.len)
return -EINVAL;
if (verify_area(VERIFY_READ, kfprog.filter,
kfprog.len * sizeof(struct sock_filter)))
return -EFAULT;
}
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_setsockopt(fd, level, optname,
(char *)&kfprog, sizeof(kfprog));
set_fs(old_fs);
kfree(kfprog.filter);
return ret;
}
......
......@@ -35,7 +35,7 @@ extern unsigned int
do_masquerade(struct sk_buff **pskb, const struct net_device *dev);
extern unsigned int
check_for_masq_error(struct sk_buff *pskb);
check_for_masq_error(struct sk_buff **pskb);
extern unsigned int
check_for_demasq(struct sk_buff **pskb);
......@@ -167,7 +167,7 @@ fw_in(unsigned int hooknum,
/* Handle ICMP errors from client here */
if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP
&& (*pskb)->nfct)
check_for_masq_error(*pskb);
check_for_masq_error(pskb);
}
return NF_ACCEPT;
......
......@@ -103,19 +103,19 @@ do_masquerade(struct sk_buff **pskb, const struct net_device *dev)
}
void
check_for_masq_error(struct sk_buff *skb)
check_for_masq_error(struct sk_buff **pskb)
{
enum ip_conntrack_info ctinfo;
struct ip_conntrack *ct;
ct = ip_conntrack_get(skb, &ctinfo);
ct = ip_conntrack_get(*pskb, &ctinfo);
/* Wouldn't be here if not tracked already => masq'ed ICMP
ping or error related to masq'd connection */
IP_NF_ASSERT(ct);
if (ctinfo == IP_CT_RELATED) {
icmp_reply_translation(skb, ct, NF_IP_PRE_ROUTING,
icmp_reply_translation(pskb, ct, NF_IP_PRE_ROUTING,
CTINFO2DIR(ctinfo));
icmp_reply_translation(skb, ct, NF_IP_POST_ROUTING,
icmp_reply_translation(pskb, ct, NF_IP_POST_ROUTING,
CTINFO2DIR(ctinfo));
}
}
......@@ -152,10 +152,10 @@ check_for_demasq(struct sk_buff **pskb)
&& skb_linearize(*pskb, GFP_ATOMIC) != 0)
return NF_DROP;
icmp_reply_translation(*pskb, ct,
icmp_reply_translation(pskb, ct,
NF_IP_PRE_ROUTING,
CTINFO2DIR(ctinfo));
icmp_reply_translation(*pskb, ct,
icmp_reply_translation(pskb, ct,
NF_IP_POST_ROUTING,
CTINFO2DIR(ctinfo));
}
......
......@@ -773,9 +773,9 @@ do_bindings(struct ip_conntrack *ct,
? "SRC" : "DST",
NIPQUAD(info->manips[i].manip.ip),
htons(info->manips[i].manip.u.all));
if (manip_pkt(proto, pskb, 0,
if (!manip_pkt(proto, pskb, 0,
&info->manips[i].manip,
info->manips[i].maniptype) < 0) {
info->manips[i].maniptype)) {
READ_UNLOCK(&ip_nat_lock);
return NF_DROP;
}
......@@ -927,11 +927,11 @@ icmp_reply_translation(struct sk_buff **pskb,
? "DST" : "SRC",
NIPQUAD(info->manips[i].manip.ip),
ntohs(info->manips[i].manip.u.udp.port));
if (manip_pkt(inside->ip.protocol, pskb,
if (!manip_pkt(inside->ip.protocol, pskb,
(*pskb)->nh.iph->ihl*4
+ sizeof(inside->icmp),
&info->manips[i].manip,
!info->manips[i].maniptype) < 0)
!info->manips[i].maniptype))
goto unlock_fail;
/* Outer packet needs to have IP header NATed like
......@@ -943,9 +943,9 @@ icmp_reply_translation(struct sk_buff **pskb,
info->manips[i].maniptype == IP_NAT_MANIP_SRC
? "SRC" : "DST",
NIPQUAD(info->manips[i].manip.ip));
if (manip_pkt(0, pskb, 0,
if (!manip_pkt(0, pskb, 0,
&info->manips[i].manip,
info->manips[i].maniptype) < 0)
info->manips[i].maniptype))
goto unlock_fail;
}
}
......
......@@ -1210,7 +1210,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT))
rtmsg.rtmsg_flags |= RTF_NONEXTHOP;
ip6_route_add(&rtmsg, NULL);
ip6_route_add(&rtmsg, NULL, NULL);
}
/* Create "default" multicast route to the interface */
......@@ -1227,7 +1227,7 @@ static void addrconf_add_mroute(struct net_device *dev)
rtmsg.rtmsg_ifindex = dev->ifindex;
rtmsg.rtmsg_flags = RTF_UP|RTF_ADDRCONF;
rtmsg.rtmsg_type = RTMSG_NEWROUTE;
ip6_route_add(&rtmsg, NULL);
ip6_route_add(&rtmsg, NULL, NULL);
}
static void sit_route_add(struct net_device *dev)
......@@ -1244,7 +1244,7 @@ static void sit_route_add(struct net_device *dev)
rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP;
rtmsg.rtmsg_ifindex = dev->ifindex;
ip6_route_add(&rtmsg, NULL);
ip6_route_add(&rtmsg, NULL, NULL);
}
static void addrconf_add_lroute(struct net_device *dev)
......@@ -1336,7 +1336,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
if (rt->rt6i_flags&RTF_EXPIRES) {
if (pinfo->onlink == 0 || valid_lft == 0) {
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
rt = NULL;
} else {
rt->rt6i_expires = rt_expires;
......@@ -1960,7 +1960,7 @@ static void addrconf_rs_timer(unsigned long data)
rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex;
ip6_route_add(&rtmsg, NULL);
ip6_route_add(&rtmsg, NULL, NULL);
}
out:
......
......@@ -502,7 +502,7 @@ static __inline__ void fib6_start_gc(struct rt6_info *rt)
* with source addr info in sub-trees
*/
int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh)
int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{
struct fib6_node *fn;
int err = -ENOMEM;
......@@ -884,7 +884,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn)
}
static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
struct nlmsghdr *nlh)
struct nlmsghdr *nlh, void *_rtattr)
{
struct fib6_walker_t *w;
struct rt6_info *rt = *rtp;
......@@ -943,7 +943,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
rt6_release(rt);
}
int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh)
int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{
struct fib6_node *fn = rt->rt6i_node;
struct rt6_info **rtp;
......@@ -968,7 +968,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh)
for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) {
if (*rtp == rt) {
fib6_del_route(fn, rtp, nlh);
fib6_del_route(fn, rtp, nlh, _rtattr);
return 0;
}
}
......@@ -1097,7 +1097,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
res = c->func(rt, c->arg);
if (res < 0) {
w->leaf = rt;
res = fib6_del(rt, NULL);
res = fib6_del(rt, NULL, NULL);
if (res) {
#if RT6_DEBUG >= 2
printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
......
......@@ -976,7 +976,7 @@ void ndisc_recv_na(struct sk_buff *skb)
struct rt6_info *rt;
rt = rt6_get_dflt_router(saddr, dev);
if (rt)
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
}
} else {
if (msg->icmph.icmp6_router)
......@@ -1050,7 +1050,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
if (rt && lifetime == 0) {
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
rt = NULL;
}
......
......@@ -324,12 +324,12 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
be destroyed.
*/
static int rt6_ins(struct rt6_info *rt, struct nlmsghdr *nlh)
static int rt6_ins(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{
int err;
write_lock_bh(&rt6_lock);
err = fib6_add(&ip6_routing_table, rt, nlh);
err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr);
write_unlock_bh(&rt6_lock);
return err;
......@@ -372,7 +372,7 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
dst_hold(&rt->u.dst);
err = rt6_ins(rt, NULL);
err = rt6_ins(rt, NULL, NULL);
if (err == 0)
return rt;
......@@ -526,7 +526,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
if (rt) {
if (rt->rt6i_flags & RTF_CACHE)
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
else
dst_release(dst);
}
......@@ -629,14 +629,17 @@ static int ipv6_get_hoplimit(struct net_device *dev)
*
*/
int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
{
int err;
struct rtmsg *r;
struct rtattr **rta;
struct rt6_info *rt;
struct net_device *dev = NULL;
int addr_type;
rta = (struct rtattr **) _rtattr;
if (rtmsg->rtmsg_dst_len > 128 || rtmsg->rtmsg_src_len > 128)
return -EINVAL;
#ifndef CONFIG_IPV6_SUBTREES
......@@ -768,13 +771,38 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr))
rt->rt6i_hoplimit = IPV6_DEFAULT_MCASTHOPS;
else if (rta && rta[RTA_HOPLIMIT-1])
memcpy(&rt->rt6i_hoplimit, RTA_DATA(rta[RTA_HOPLIMIT-1]), 1);
else
rt->rt6i_hoplimit = ipv6_get_hoplimit(dev);
rt->rt6i_flags = rtmsg->rtmsg_flags;
install_route:
if (rta && rta[RTA_METRICS-1]) {
int attrlen = RTA_PAYLOAD(rta[RTA_METRICS-1]);
struct rtattr *attr = RTA_DATA(rta[RTA_METRICS-1]);
while (RTA_OK(attr, attrlen)) {
unsigned flavor = attr->rta_type;
if (flavor) {
if (flavor > RTAX_MAX) {
err = -EINVAL;
goto out;
}
rt->u.dst.metrics[flavor-1] =
*(u32 *)RTA_DATA(attr);
}
attr = RTA_NEXT(attr, attrlen);
}
}
if (!rt->u.dst.metrics[RTAX_MTU-1])
rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev);
rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60, ip6_rt_min_advmss);
if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
rt->u.dst.metrics[RTAX_ADVMSS-1] =
max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60,
ip6_rt_min_advmss);
/* Maximal non-jumbo IPv6 payload is 65535 and corresponding
MSS is 65535 - tcp_header_size. 65535 is also valid and
means: "any MSS, rely only on pmtu discovery"
......@@ -782,7 +810,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
if (dst_metric(&rt->u.dst, RTAX_ADVMSS) > 65535-20)
rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
rt->u.dst.dev = dev;
return rt6_ins(rt, nlh);
return rt6_ins(rt, nlh, _rtattr);
out:
if (dev)
......@@ -791,7 +819,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
return err;
}
int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh)
int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{
int err;
......@@ -803,13 +831,13 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh)
dst_release(&rt->u.dst);
err = fib6_del(rt, nlh);
err = fib6_del(rt, nlh, _rtattr);
write_unlock_bh(&rt6_lock);
return err;
}
static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
{
struct fib6_node *fn;
struct rt6_info *rt;
......@@ -836,7 +864,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock);
return ip6_del_rt(rt, nlh);
return ip6_del_rt(rt, nlh, _rtattr);
}
}
read_unlock_bh(&rt6_lock);
......@@ -938,11 +966,11 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr,
nrt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev);
if (rt6_ins(nrt, NULL))
if (rt6_ins(nrt, NULL, NULL))
goto out;
if (rt->rt6i_flags&RTF_CACHE) {
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
return;
}
......@@ -1028,7 +1056,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires);
nrt->rt6i_flags |= RTF_DYNAMIC|RTF_CACHE|RTF_EXPIRES;
nrt->u.dst.metrics[RTAX_MTU-1] = pmtu;
rt6_ins(nrt, NULL);
rt6_ins(nrt, NULL, NULL);
}
out:
......@@ -1099,7 +1127,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr,
rtmsg.rtmsg_ifindex = dev->ifindex;
ip6_route_add(&rtmsg, NULL);
ip6_route_add(&rtmsg, NULL, NULL);
return rt6_get_dflt_router(gwaddr, dev);
}
......@@ -1125,7 +1153,7 @@ void rt6_purge_dflt_routers(int last_resort)
read_unlock_bh(&rt6_lock);
ip6_del_rt(rt, NULL);
ip6_del_rt(rt, NULL, NULL);
goto restart;
}
......@@ -1151,10 +1179,10 @@ int ipv6_route_ioctl(unsigned int cmd, void *arg)
rtnl_lock();
switch (cmd) {
case SIOCADDRT:
err = ip6_route_add(&rtmsg, NULL);
err = ip6_route_add(&rtmsg, NULL, NULL);
break;
case SIOCDELRT:
err = ip6_route_del(&rtmsg, NULL);
err = ip6_route_del(&rtmsg, NULL, NULL);
break;
default:
err = -EINVAL;
......@@ -1210,7 +1238,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
rt->rt6i_dst.plen = 128;
rt6_ins(rt, NULL);
rt6_ins(rt, NULL, NULL);
return 0;
}
......@@ -1227,7 +1255,7 @@ int ip6_rt_addr_del(struct in6_addr *addr, struct net_device *dev)
rt = rt6_lookup(addr, NULL, loopback_dev.ifindex, 1);
if (rt) {
if (rt->rt6i_dst.plen == 128)
err = ip6_del_rt(rt, NULL);
err = ip6_del_rt(rt, NULL, NULL);
else
dst_release(&rt->u.dst);
}
......@@ -1357,7 +1385,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
return -EINVAL;
return ip6_route_del(&rtmsg, nlh);
return ip6_route_del(&rtmsg, nlh, arg);
}
int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
......@@ -1367,7 +1395,7 @@ int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
return -EINVAL;
return ip6_route_add(&rtmsg, nlh);
return ip6_route_add(&rtmsg, nlh, arg);
}
struct rt6_rtnl_dump_arg
......
......@@ -1090,15 +1090,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
return x;
out:
if (x->aalg)
kfree(x->aalg);
if (x->ealg)
kfree(x->ealg);
if (x->calg)
kfree(x->calg);
if (x->encap)
kfree(x->encap);
kfree(x);
xfrm_state_put(x);
return ERR_PTR(-ENOBUFS);
}
......
......@@ -228,13 +228,11 @@ EXPORT_SYMBOL(destroy_EII_client);
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
EXPORT_SYMBOL(dev_change_flags);
#endif
EXPORT_SYMBOL(vlan_ioctl_set);
EXPORT_SYMBOL(scm_detach_fds);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
EXPORT_SYMBOL(br_handle_frame_hook);
EXPORT_SYMBOL(brioctl_set);
#endif
#ifdef CONFIG_NET_DIVERT
......@@ -285,11 +283,6 @@ EXPORT_SYMBOL(unregister_inetaddr_notifier);
/* needed for ip_gre -cw */
EXPORT_SYMBOL(ip_statistics);
#ifdef CONFIG_DLCI_MODULE
extern int (*dlci_ioctl_hook)(unsigned int, void *);
EXPORT_SYMBOL(dlci_ioctl_hook);
#endif
EXPORT_SYMBOL(xfrm_user_policy);
EXPORT_SYMBOL(km_waitq);
EXPORT_SYMBOL(km_new_mapping);
......
......@@ -731,6 +731,7 @@ void brioctl_set(int (*hook)(unsigned long))
br_ioctl_hook = hook;
up(&br_ioctl_mutex);
}
EXPORT_SYMBOL(brioctl_set);
static DECLARE_MUTEX(vlan_ioctl_mutex);
static int (*vlan_ioctl_hook)(unsigned long arg);
......@@ -741,12 +742,18 @@ void vlan_ioctl_set(int (*hook)(unsigned long))
vlan_ioctl_hook = hook;
up(&vlan_ioctl_mutex);
}
EXPORT_SYMBOL(vlan_ioctl_set);
#ifdef CONFIG_DLCI
extern int dlci_ioctl(unsigned int, void *);
#else
int (*dlci_ioctl_hook)(unsigned int, void *);
#endif
static DECLARE_MUTEX(dlci_ioctl_mutex);
static int (*dlci_ioctl_hook)(unsigned int, void *);
void dlci_ioctl_set(int (*hook)(unsigned int, void *))
{
down(&dlci_ioctl_mutex);
dlci_ioctl_hook = hook;
up(&dlci_ioctl_mutex);
}
EXPORT_SYMBOL(dlci_ioctl_set);
/*
* With an ioctl, arg may well be a user mode pointer, but we don't know
......@@ -820,24 +827,16 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break;
case SIOCADDDLCI:
case SIOCDELDLCI:
/* Convert this to always call through a hook */
#ifdef CONFIG_DLCI
lock_kernel();
err = dlci_ioctl(cmd, (void *)arg);
unlock_kernel();
break;
#else
err = -ENOPKG;
#ifdef CONFIG_KMOD
if (!dlci_ioctl_hook)
request_module("dlci");
#endif
if (dlci_ioctl_hook) {
lock_kernel();
down(&dlci_ioctl_mutex);
err = dlci_ioctl_hook(cmd, (void *)arg);
unlock_kernel();
up(&dlci_ioctl_mutex);
}
#endif
break;
default:
err = sock->ops->ioctl(sock, cmd, arg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment