mirror of
https://github.com/samba-team/samba.git
synced 2025-03-10 12:58:35 +03:00
rewrote nmbd's wins backend to use a tdb instead of a flat text file.
Changed the way the wins record are handled in memory. Now they are living much longer with the different states: active, released and tombstone. Also added a version ID, some wins flags and the wins owner ip address to the namrec->data struct, and a function to process messages sent by the wins replication daemon. the initiate_wins_processing() function is not correct, I'll fix it later. J.F.
This commit is contained in:
parent
f0137ac126
commit
b902e087d0
@ -22,6 +22,12 @@
|
||||
|
||||
*/
|
||||
|
||||
#define INFO_VERSION "INFO/version"
|
||||
#define INFO_COUNT "INFO/num_entries"
|
||||
#define INFO_ID_HIGH "INFO/id_high"
|
||||
#define INFO_ID_LOW "INFO/id_low"
|
||||
#define ENTRY_PREFIX "ENTRY/"
|
||||
|
||||
#define PERMANENT_TTL 0
|
||||
|
||||
/* NTAS uses 2, NT uses 1, WfWg uses 0 */
|
||||
@ -84,6 +90,33 @@ enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH,
|
||||
/* Mask applied to outgoing NetBIOS flags. */
|
||||
#define NB_FLGMSK 0xE0
|
||||
|
||||
/* The wins flags. Looks like the nbflags ! */
|
||||
#define WINS_UNIQUE 0x00 /* Unique record */
|
||||
#define WINS_NGROUP 0x01 /* Normal Group eg: 1B */
|
||||
#define WINS_SGROUP 0x02 /* Special Group eg: 1C */
|
||||
#define WINS_MHOMED 0x03 /* MultiHomed */
|
||||
|
||||
#define WINS_ACTIVE 0x00 /* active record */
|
||||
#define WINS_RELEASED 0x04 /* released record */
|
||||
#define WINS_TOMBSTONED 0x08 /* tombstoned record */
|
||||
#define WINS_DELETED 0x0C /* deleted record */
|
||||
|
||||
#define WINS_STATE_MASK 0x0C
|
||||
|
||||
#define WINS_LOCAL 0x00 /* local record */
|
||||
#define WINS_REMOTE 0x10 /* remote record */
|
||||
|
||||
#define WINS_BNODE 0x00 /* Broadcast node */
|
||||
#define WINS_PNODE 0x20 /* PtP node */
|
||||
#define WINS_MNODE 0x40 /* Mixed node */
|
||||
#define WINS_HNODE 0x60 /* Hybrid node */
|
||||
|
||||
#define WINS_NONSTATIC 0x00 /* dynamic record */
|
||||
#define WINS_STATIC 0x80 /* static record */
|
||||
|
||||
#define WINS_STATE_ACTIVE(p) (((p)->data.wins_flags & WINS_STATE_MASK) == WINS_ACTIVE)
|
||||
|
||||
|
||||
/* NetBIOS flag identifier. */
|
||||
#define NAME_GROUP(p) ((p)->data.nb_flags & NB_GROUP)
|
||||
#define NAME_BFLAG(p) (((p)->data.nb_flags & NB_NODETYPEMASK) == NB_BFLAG)
|
||||
@ -180,6 +213,11 @@ struct nmb_data
|
||||
|
||||
time_t death_time; /* The time the record must be removed (do not remove if 0). */
|
||||
time_t refresh_time; /* The time the record should be refreshed. */
|
||||
|
||||
SMB_BIG_UINT id; /* unique id */
|
||||
struct in_addr wins_ip; /* the adress of the wins server this record comes from */
|
||||
|
||||
int wins_flags; /* similar to the netbios flags but different ! */
|
||||
};
|
||||
|
||||
/* This structure represents an entry in a local netbios name list. */
|
||||
@ -556,6 +594,12 @@ struct packet_struct
|
||||
affects non-permanent self names (in seconds) */
|
||||
#define MAX_REFRESH_TIME (60*20)
|
||||
|
||||
/* The Extinction interval: 4 days, time a node will stay in released state */
|
||||
#define EXTINCTION_INTERVAL (4*24*60*60)
|
||||
|
||||
/* The Extinction time-out: 1 day, time a node will stay in deleted state */
|
||||
#define EXTINCTION_TIMEOUT (24*60*60)
|
||||
|
||||
/* Macro's to enumerate subnets either with or without
|
||||
the UNICAST subnet. */
|
||||
|
||||
@ -568,6 +612,18 @@ extern struct subnet_record *remote_broadcast_subnet;
|
||||
#define NEXT_SUBNET_EXCLUDING_UNICAST(x) ((x)->next)
|
||||
#define NEXT_SUBNET_INCLUDING_UNICAST(x) (get_next_subnet_maybe_unicast((x)))
|
||||
|
||||
/* wins replication record used between nmbd and wrepld */
|
||||
typedef struct _WINS_RECORD {
|
||||
char name[17];
|
||||
char type;
|
||||
int nb_flags;
|
||||
int wins_flags;
|
||||
SMB_BIG_UINT id;
|
||||
int num_ips;
|
||||
struct in_addr ip[25];
|
||||
struct in_addr wins_ip;
|
||||
} WINS_RECORD;
|
||||
|
||||
/* To be removed. */
|
||||
enum state_type { TEST };
|
||||
#endif /* _NAMESERV_H_ */
|
||||
|
@ -827,6 +827,7 @@ static void usage(char *pname)
|
||||
pidfile_create("nmbd");
|
||||
message_init();
|
||||
message_register(MSG_FORCE_ELECTION, nmbd_message_election);
|
||||
message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry);
|
||||
|
||||
DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) );
|
||||
|
||||
|
@ -213,6 +213,7 @@ struct name_record *add_name_to_subnet( struct subnet_record *subrec,
|
||||
|
||||
/* Enter the name as active. */
|
||||
namerec->data.nb_flags = nb_flags | NB_ACTIVE;
|
||||
namerec->data.wins_flags = WINS_ACTIVE;
|
||||
|
||||
/* If it's our primary name, flag it as so. */
|
||||
if( strequal( my_netbios_names[0], name ) )
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user