~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to linux/net/ipsec/ipsec_mast.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * for more details.
15
15
 */
16
16
 
17
 
char ipsec_mast_c_version[] = "RCSID $Id: ipsec_mast.c,v 1.3 2003/10/31 02:27:55 mcr Exp $";
 
17
char ipsec_mast_c_version[] = "RCSID $Id: ipsec_mast.c,v 1.6 2004/12/03 21:25:57 mcr Exp $";
18
18
 
19
19
#define __NO_VERSION__
20
20
#include <linux/module.h>
74
74
int ipsec_maxdevice_count = -1;
75
75
 
76
76
DEBUG_NO_STATIC int
77
 
ipsec_mast_open(struct device *dev)
 
77
ipsec_mast_open(struct net_device *dev)
78
78
{
79
79
        struct ipsecpriv *prv = dev->priv;
80
80
        
90
90
        if (prv->dev == NULL)
91
91
                return -ENODEV;
92
92
        
93
 
        MOD_INC_USE_COUNT;
 
93
        KLIPS_INC_USE;
94
94
        return 0;
95
95
}
96
96
 
97
97
DEBUG_NO_STATIC int
98
 
ipsec_mast_close(struct device *dev)
 
98
ipsec_mast_close(struct net_device *dev)
99
99
{
100
 
        MOD_DEC_USE_COUNT;
 
100
        KLIPS_DEC_USE;
101
101
        return 0;
102
102
}
103
103
 
215
215
 *      and that skb is filled properly by that function.
216
216
 */
217
217
int
218
 
ipsec_mast_start_xmit(struct sk_buff *skb, struct device *dev, IPsecSAref_t SAref)
 
218
ipsec_mast_start_xmit(struct sk_buff *skb, struct net_device *dev, IPsecSAref_t SAref)
219
219
{
220
220
        struct ipsec_xmit_state ixs_mem;
221
221
        struct ipsec_xmit_state *ixs = &ixs_mem;
241
241
#endif
242
242
 
243
243
DEBUG_NO_STATIC struct net_device_stats *
244
 
ipsec_mast_get_stats(struct device *dev)
 
244
ipsec_mast_get_stats(struct net_device *dev)
245
245
{
246
246
        return &(((struct ipsecpriv *)(dev->priv))->mystats);
247
247
}
252
252
 */
253
253
 
254
254
DEBUG_NO_STATIC int
255
 
ipsec_mast_hard_header(struct sk_buff *skb, struct device *dev,
 
255
ipsec_mast_hard_header(struct sk_buff *skb, struct net_device *dev,
256
256
        unsigned short type, void *daddr, void *saddr, unsigned len)
257
257
{
258
258
        struct ipsecpriv *prv = dev->priv;
259
 
        struct device *tmp;
 
259
        struct net_device *tmp;
260
260
        int ret;
261
261
        struct net_device_stats *stats; /* This device's statistics */
262
262
        
329
329
                        return -ENODEV;
330
330
                }
331
331
                
332
 
#define da ((struct device *)(prv->dev))->dev_addr
 
332
#define da ((struct net_device *)(prv->dev))->dev_addr
333
333
                KLIPS_PRINT(debug_mast & DB_MAST_REVEC,
334
334
                            "klips_debug:ipsec_mast_hard_header: "
335
335
                            "Revectored 0p%p->0p%p len=%d type=%d dev=%s->%s dev_addr=%02x:%02x:%02x:%02x:%02x:%02x ",
360
360
ipsec_mast_rebuild_header(struct sk_buff *skb)
361
361
{
362
362
        struct ipsecpriv *prv = skb->dev->priv;
363
 
        struct device *tmp;
 
363
        struct net_device *tmp;
364
364
        int ret;
365
365
        struct net_device_stats *stats; /* This device's statistics */
366
366
        
420
420
}
421
421
 
422
422
DEBUG_NO_STATIC int
423
 
ipsec_mast_set_mac_address(struct device *dev, void *addr)
 
423
ipsec_mast_set_mac_address(struct net_device *dev, void *addr)
424
424
{
425
425
        struct ipsecpriv *prv = dev->priv;
426
426
        
469
469
}
470
470
 
471
471
DEBUG_NO_STATIC void
472
 
ipsec_mast_cache_update(struct hh_cache *hh, struct device *dev, unsigned char *  haddr)
 
472
ipsec_mast_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char *  haddr)
473
473
{
474
474
        struct ipsecpriv *prv = dev->priv;
475
475
        
530
530
}
531
531
 
532
532
DEBUG_NO_STATIC int
533
 
ipsec_mast_neigh_setup_dev(struct device *dev, struct neigh_parms *p)
 
533
ipsec_mast_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
534
534
{
535
535
        KLIPS_PRINT(debug_mast & DB_MAST_REVEC,
536
536
                    "klips_debug:ipsec_mast_neigh_setup_dev: "
550
550
 */
551
551
 
552
552
DEBUG_NO_STATIC int
553
 
ipsec_mast_attach(struct device *dev, struct device *physdev)
 
553
ipsec_mast_attach(struct net_device *dev, struct net_device *physdev)
554
554
{
555
555
        int i;
556
556
        struct ipsecpriv *prv = dev->priv;
613
613
        for (i=0; i<dev->addr_len; i++) {
614
614
                dev->dev_addr[i] = physdev->dev_addr[i];
615
615
        }
616
 
#ifdef CONFIG_IPSEC_DEBUG
 
616
#ifdef CONFIG_KLIPS_DEBUG
617
617
        if(debug_mast & DB_MAST_INIT) {
618
618
                printk(KERN_INFO "klips_debug:ipsec_mast_attach: "
619
619
                       "physical device %s being attached has HW address: %2x",
623
623
                }
624
624
                printk("\n");
625
625
        }
626
 
#endif /* CONFIG_IPSEC_DEBUG */
 
626
#endif /* CONFIG_KLIPS_DEBUG */
627
627
 
628
628
        return 0;
629
629
}
633
633
 */
634
634
 
635
635
DEBUG_NO_STATIC int
636
 
ipsec_mast_detach(struct device *dev)
 
636
ipsec_mast_detach(struct net_device *dev)
637
637
{
638
638
        int i;
639
639
        struct ipsecpriv *prv = dev->priv;
710
710
ipsec_mast_clear(void)
711
711
{
712
712
        int i;
713
 
        struct device *ipsecdev = NULL, *prvdev;
 
713
        struct net_device *ipsecdev = NULL, *prvdev;
714
714
        struct ipsecpriv *prv;
715
715
        char name[9];
716
716
        int ret;
722
722
                sprintf(name, IPSEC_DEV_FORMAT, i);
723
723
                if((ipsecdev = ipsec_dev_get(name)) != NULL) {
724
724
                        if((prv = (struct ipsecpriv *)(ipsecdev->priv))) {
725
 
                                prvdev = (struct device *)(prv->dev);
 
725
                                prvdev = (struct net_device *)(prv->dev);
726
726
                                if(prvdev) {
727
727
                                        KLIPS_PRINT(debug_mast & DB_MAST_INIT,
728
728
                                                    "klips_debug:ipsec_mast_clear: "
743
743
}
744
744
 
745
745
DEBUG_NO_STATIC int
746
 
ipsec_mast_ioctl(struct device *dev, struct ifreq *ifr, int cmd)
 
746
ipsec_mast_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
747
747
{
748
748
        struct ipsecmastconf *cf = (struct ipsecmastconf *)&ifr->ifr_data;
749
749
        struct ipsecpriv *prv = dev->priv;
750
 
        struct device *them; /* physical device */
 
750
        struct net_device *them; /* physical device */
751
751
#ifdef CONFIG_IP_ALIAS
752
752
        char *colon;
753
753
        char realphysname[IFNAMSIZ];
839
839
int
840
840
ipsec_mast_device_event(struct notifier_block *unused, unsigned long event, void *ptr)
841
841
{
842
 
        struct device *dev = ptr;
843
 
        struct device *ipsec_dev;
 
842
        struct net_device *dev = ptr;
 
843
        struct net_device *ipsec_dev;
844
844
        struct ipsecpriv *priv;
845
845
        char name[9];
846
846
        int i;
893
893
                                priv = (struct ipsecpriv *)(ipsec_dev->priv);
894
894
                                if(priv) {
895
895
                                        ;
896
 
                                        if(((struct device *)(priv->dev)) == dev) {
 
896
                                        if(((struct net_device *)(priv->dev)) == dev) {
897
897
                                                /* dev_close(ipsec_dev); */
898
898
                                                /* return */ ipsec_mast_detach(ipsec_dev);
899
899
                                                KLIPS_PRINT(debug_mast & DB_MAST_INIT,
978
978
 */
979
979
 
980
980
int
981
 
ipsec_mast_init(struct device *dev)
 
981
ipsec_mast_init(struct net_device *dev)
982
982
{
983
983
        int i;
984
984
 
1030
1030
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1031
1031
 
1032
1032
int
1033
 
ipsec_mast_probe(struct device *dev)
 
1033
ipsec_mast_probe(struct net_device *dev)
1034
1034
{
1035
1035
        ipsec_mast_init(dev); 
1036
1036
        return 0;
1049
1049
        int error = 0;
1050
1050
        int i;
1051
1051
        char name[10];
1052
 
        struct device *dev_mast;
 
1052
        struct net_device *dev_mast;
1053
1053
        
1054
1054
        for(i = 0; i < ipsec_mastdevice_count; i++) {
1055
1055
                sprintf(name, MAST_DEV_FORMAT, i);
1065
1065
 
1066
1066
/*
1067
1067
 * $Log: ipsec_mast.c,v $
 
1068
 * Revision 1.6  2004/12/03 21:25:57  mcr
 
1069
 *      compile time fixes for running on 2.6.
 
1070
 *      still experimental.
 
1071
 *
 
1072
 * Revision 1.5  2004/08/03 18:19:08  mcr
 
1073
 *      in 2.6, use "net_device" instead of #define device->net_device.
 
1074
 *      this probably breaks 2.0 compiles.
 
1075
 *
 
1076
 * Revision 1.4  2004/07/10 19:11:18  mcr
 
1077
 *      CONFIG_IPSEC -> CONFIG_KLIPS.
 
1078
 *
1068
1079
 * Revision 1.3  2003/10/31 02:27:55  mcr
1069
1080
 *      pulled up port-selector patches and sa_id elimination.
1070
1081
 *