mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 06:38:04 +00:00 
			
		
		
		
	* zebra/irdp.h * irdp_send_thread(): move prototype to common header file * irdp_advert_off(): idem * process_solicit(): idem * irdp_read_raw(): idem * send_packet(): idem * zebra/irdp_interface.c * inet_2a(): move function to where it is used * in_cksum(): lib/checksum.h already provides prototype * irdp_send_thread(): prototype moved away * inet_2a(): idem * irdp_advert_off(): idem * b1, b2, b3, b4: get rid of global buffers for inet_2a() * if_group(): add local buffer for inet_2a() * if_add_group(): idem * if_drop_group(): idem * irdp_config_write(): idem * Adv_new(): make static * zebra/irdp_main.c * irdp_read_raw(): prototype moved away * send_packet(): idem * in_cksum(): lib/checksum.h already provides prototype * inet_2a(): function moved to irdp_interface.c * zebra/irdp_packet.c * b1, b2, b3, b4: get rid of global buffers for inet_2a() * in_cksum(): lib/checksum.h already provides prototype * process_solicit(): prototype moved away * irdp_read_raw(): fix uninitialized variable
		
			
				
	
	
		
			158 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			158 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* ICMP Router Discovery Messages
 | 
						|
 * Copyright (C) 1997, 2000 Kunihiro Ishiguro
 | 
						|
 *
 | 
						|
 * This file is part of GNU Zebra.
 | 
						|
 *
 | 
						|
 * GNU Zebra is free software; you can redistribute it and/or modify it
 | 
						|
 * under the terms of the GNU General Public License as published by the
 | 
						|
 * Free Software Foundation; either version 2, or (at your option) any
 | 
						|
 * later version.
 | 
						|
 *
 | 
						|
 * GNU Zebra is distributed in the hope that it will be useful, but
 | 
						|
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
						|
 * General Public License for more details.
 | 
						|
 *
 | 
						|
 * You should have received a copy of the GNU General Public License
 | 
						|
 * along with GNU Zebra; see the file COPYING.  If not, write to the Free
 | 
						|
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 | 
						|
 * 02111-1307, USA.  
 | 
						|
 */
 | 
						|
 | 
						|
/* 
 | 
						|
 * This file is modified and completed for the Zebra IRDP implementation
 | 
						|
 * by Robert Olsson, Swedish University of Agricultural Sciences
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef _IRDP_H
 | 
						|
#define _IRDP_H
 | 
						|
 | 
						|
#include "lib/vty.h"
 | 
						|
 | 
						|
#define TRUE 1
 | 
						|
#define FALSE 0
 | 
						|
 | 
						|
/* ICMP Messages */
 | 
						|
#ifndef ICMP_ROUTERADVERT
 | 
						|
#define ICMP_ROUTERADVERT 9
 | 
						|
#endif /* ICMP_ROUTERADVERT */
 | 
						|
 | 
						|
#ifndef ICMP_ROUTERSOLICIT
 | 
						|
#define ICMP_ROUTERSOLICIT 10
 | 
						|
#endif /* ICMP_ROUTERSOLICT */
 | 
						|
 | 
						|
/* Multicast groups */
 | 
						|
#ifndef INADDR_ALLHOSTS_GROUP
 | 
						|
#define INADDR_ALLHOSTS_GROUP 0xe0000001U    /* 224.0.0.1 */
 | 
						|
#endif /* INADDR_ALLHOSTS_GROUP */
 | 
						|
 | 
						|
#ifndef INADDR_ALLRTRS_GROUP
 | 
						|
#define INADDR_ALLRTRS_GROUP  0xe0000002U    /* 224.0.0.2 */
 | 
						|
#endif /* INADDR_ALLRTRS_GROUP */
 | 
						|
 | 
						|
/* Default irdp packet interval */
 | 
						|
#define IRDP_DEFAULT_INTERVAL 300 
 | 
						|
 | 
						|
/* Router constants from RFC1256 */
 | 
						|
#define MAX_INITIAL_ADVERT_INTERVAL 16
 | 
						|
#define MAX_INITIAL_ADVERTISEMENTS   3
 | 
						|
#define MAX_RESPONSE_DELAY           2
 | 
						|
 | 
						|
#define IRDP_MAXADVERTINTERVAL 600
 | 
						|
#define IRDP_MINADVERTINTERVAL 450 /* 0.75*600 */
 | 
						|
#define IRDP_LIFETIME         1350 /* 3*450 */
 | 
						|
#define IRDP_PREFERENCE 0
 | 
						|
 | 
						|
#define ICMP_MINLEN 8
 | 
						|
 | 
						|
#define IRDP_LAST_ADVERT_MESSAGES 2 /* The last adverts with Holdtime 0 */
 | 
						|
 | 
						|
#define IRDP_RX_BUF 1500
 | 
						|
 | 
						|
/* 
 | 
						|
     Comments comes from RFC1256 ICMP Router Discovery Messages. 
 | 
						|
 | 
						|
     The IP destination address to be used for multicast Router
 | 
						|
     Advertisements sent from the interface.  The only permissible
 | 
						|
     values are the all-systems multicast address, 224.0.0.1, or the
 | 
						|
     limited-broadcast address, 255.255.255.255.  (The all-systems
 | 
						|
     address is preferred wherever possible, i.e., on any link where
 | 
						|
     all listening hosts support IP multicast.)
 | 
						|
 | 
						|
     Default: 224.0.0.1 if the router supports IP multicast on the
 | 
						|
     interface, else 255.255.255.255 
 | 
						|
 | 
						|
     The maximum time allowed between sending multicast Router
 | 
						|
     Advertisements from the interface, in seconds.  Must be no less
 | 
						|
     than 4 seconds and no greater than 1800 seconds.
 | 
						|
 | 
						|
     Default: 600 seconds 
 | 
						|
 | 
						|
     The minimum time allowed between sending unsolicited multicast
 | 
						|
     Router Advertisements from the interface, in seconds.  Must be no
 | 
						|
     less than 3 seconds and no greater than MaxAdvertisementInterval.
 | 
						|
 | 
						|
     Default: 0.75 * MaxAdvertisementInterval 
 | 
						|
 | 
						|
     The value to be placed in the Lifetime field of Router
 | 
						|
     Advertisements sent from the interface, in seconds.  Must be no
 | 
						|
     less than MaxAdvertisementInterval and no greater than 9000
 | 
						|
     seconds.
 | 
						|
 | 
						|
     Default: 3 * MaxAdvertisementInterval 
 | 
						|
 | 
						|
     The preferability of the address as a default router address,
 | 
						|
     relative to other router addresses on the same subnet.  A 32-bit,
 | 
						|
     signed, twos-complement integer, with higher values meaning more
 | 
						|
     preferable.  The minimum value (hex 80000000) is used to indicate
 | 
						|
     that the address, even though it may be advertised, is not to be
 | 
						|
     used by neighboring hosts as a default router address.
 | 
						|
 | 
						|
     Default: 0 
 | 
						|
*/
 | 
						|
 | 
						|
struct irdp_interface 
 | 
						|
{
 | 
						|
  unsigned long MaxAdvertInterval;
 | 
						|
  unsigned long MinAdvertInterval;
 | 
						|
  unsigned long Preference;
 | 
						|
 | 
						|
  u_int32_t flags;
 | 
						|
 | 
						|
#define IF_ACTIVE               (1<<0) /* ICMP Active */
 | 
						|
#define IF_BROADCAST            (1<<1) /* 255.255.255.255 */
 | 
						|
#define IF_SOLICIT              (1<<2) /* Solicit active */
 | 
						|
#define IF_DEBUG_MESSAGES       (1<<3) 
 | 
						|
#define IF_DEBUG_PACKET         (1<<4) 
 | 
						|
#define IF_DEBUG_MISC           (1<<5) 
 | 
						|
#define IF_SHUTDOWN             (1<<6) 
 | 
						|
 | 
						|
  struct interface *ifp;
 | 
						|
  struct thread *t_advertise;
 | 
						|
  unsigned long irdp_sent;
 | 
						|
  u_int16_t Lifetime;
 | 
						|
 | 
						|
 struct list *AdvPrefList;
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
struct Adv 
 | 
						|
{
 | 
						|
  struct in_addr ip;
 | 
						|
  int pref;
 | 
						|
};
 | 
						|
 | 
						|
extern void irdp_init(void);
 | 
						|
extern int irdp_sock_init(void);
 | 
						|
extern void irdp_finish(void);
 | 
						|
extern void irdp_config_write (struct vty *, struct interface *);
 | 
						|
extern int irdp_send_thread(struct thread *t_advert);
 | 
						|
extern void irdp_advert_off(struct interface *ifp);
 | 
						|
extern void process_solicit (struct interface *ifp);
 | 
						|
extern int irdp_read_raw(struct thread *r);
 | 
						|
extern void send_packet(struct interface *ifp, struct stream *s,
 | 
						|
			u_int32_t dst, struct prefix *p, u_int32_t ttl);
 | 
						|
 | 
						|
 | 
						|
#endif /* _IRDP_H */
 |