Kaynağa Gözat

[proto] Remove unsupported NMB protocol

The NMB protocol code came from legacy Etherboot and was never updated
to work as a gPXE protocol.  There has been no demand for this protocol,
so this patch removes it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.0.0
Stefan Hajnoczi 15 yıl önce
ebeveyn
işleme
26f882bf64
5 değiştirilmiş dosya ile 0 ekleme ve 137 silme
  1. 0
    1
      src/Makefile
  2. 0
    3
      src/config/config.c
  3. 0
    1
      src/config/general.h
  4. 0
    22
      src/include/nmb.h
  5. 0
    110
      src/proto/nmb.c

+ 0
- 1
src/Makefile Dosyayı Görüntüle

@@ -54,7 +54,6 @@ BFD_DIR		:= $(BINUTILS_DIR)
54 54
 SRCDIRS		:=
55 55
 SRCDIRS		+= libgcc
56 56
 SRCDIRS		+= core
57
-SRCDIRS		+= proto
58 57
 SRCDIRS		+= net net/tcp net/udp net/infiniband net/80211
59 58
 SRCDIRS		+= image
60 59
 SRCDIRS		+= drivers/bus

+ 0
- 3
src/config/config.c Dosyayı Görüntüle

@@ -146,9 +146,6 @@ REQUIRE_OBJECT ( ib_srpboot );
146 146
 #ifdef DNS_RESOLVER
147 147
 REQUIRE_OBJECT ( dns );
148 148
 #endif
149
-#ifdef NMB_RESOLVER
150
-REQUIRE_OBJECT ( nmb );
151
-#endif
152 149
 
153 150
 /*
154 151
  * Drag in all requested image formats

+ 0
- 1
src/config/general.h Dosyayı Görüntüle

@@ -83,7 +83,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
83 83
  */
84 84
 
85 85
 #define	DNS_RESOLVER		/* DNS resolver */
86
-#undef	NMB_RESOLVER		/* NMB resolver */
87 86
 
88 87
 /*
89 88
  * Image types

+ 0
- 22
src/include/nmb.h Dosyayı Görüntüle

@@ -1,22 +0,0 @@
1
-#ifndef NMB_H
2
-#define NMB_H
3
-
4
-#include <gpxe/dns.h>
5
-
6
-/*
7
- * NetBIOS name query packets are basically the same as DNS packets,
8
- * though the resource record format is different.
9
- *
10
- */
11
-
12
-#define DNS_TYPE_NB		0x20
13
-#define DNS_FLAG_BROADCAST	( 0x01 << 4 )
14
-#define NBNS_UDP_PORT		137
15
-
16
-struct dns_rr_info_nb {
17
-	struct dns_rr_info info;
18
-	uint16_t	nb_flags;
19
-	struct in_addr	nb_address;
20
-} __attribute__ (( packed ));
21
-
22
-#endif /* NMB_H */

+ 0
- 110
src/proto/nmb.c Dosyayı Görüntüle

@@ -1,110 +0,0 @@
1
-#if 0
2
-
3
-#include "resolv.h"
4
-#include "string.h"
5
-#include <gpxe/dns.h>
6
-#include "nic.h"
7
-#include "nmb.h"
8
-
9
-/*
10
- * Convert a standard NUL-terminated string to an NBNS query name.
11
- *
12
- * Returns a pointer to the character following the constructed NBNS
13
- * query name.
14
- *
15
- */
16
-static inline char * nbns_make_name ( char *dest, const char *name ) {
17
-	char nb_name[16];
18
-	char c;
19
-	int i;
20
-	uint16_t *d;
21
-
22
-	*(dest++) = 32; /* Length is always 32 */
23
-
24
-	/* Name encoding is as follows: pad the name with spaces to
25
-	 * length 15, and add a NUL.  Take this 16-byte string, split
26
-	 * it into nibbles and add 0x41 to each nibble to form a byte
27
-	 * of the resulting name string.
28
-	 */
29
-	memset ( nb_name, ' ', 15 );
30
-	nb_name[15] = '\0';
31
-	memcpy ( nb_name, name, strlen ( name ) ); /* Do not copy NUL */
32
-
33
-	d = ( uint16_t * ) dest;
34
-	for ( i = 0 ; i < 16 ; i++ ) {
35
-		c = nb_name[i];
36
-		*( d++ )  = htons ( ( ( c | ( c << 4 ) ) & 0x0f0f ) + 0x4141 );
37
-	}
38
-	dest = ( char * ) d;
39
-
40
-	*(dest++) = 0; /* Terminating 0-length name component */
41
-	return dest;
42
-}
43
-
44
-/*
45
- * Resolve a name using NMB
46
- *
47
- */
48
-static int nmb_resolv ( struct in_addr *addr, const char *name ) {
49
-	struct dns_query query;
50
-	struct dns_query_info *query_info;
51
-	struct dns_header *reply;
52
-	struct dns_rr_info *rr_info;
53
-	struct dns_rr_info_nb *rr_info_nb;
54
-	struct sockaddr_in nameserver;
55
-
56
-	DBG ( "NMB resolving %s\n", name );
57
-
58
-	/* Set up the query data */
59
-	nameserver.sin_addr.s_addr = INADDR_BROADCAST;
60
-	nameserver.sin_port = NBNS_UDP_PORT;
61
-	memset ( &query, 0, sizeof ( query ) );
62
-	query.dns.id = htons ( 1 );
63
-	query.dns.flags = htons ( DNS_FLAG_QUERY | DNS_FLAG_OPCODE_QUERY |
64
-				  DNS_FLAG_RD | DNS_FLAG_BROADCAST );
65
-	query.dns.qdcount = htons ( 1 );
66
-	query_info = ( void * )	nbns_make_name ( query.payload, name );
67
-	query_info->qtype = htons ( DNS_TYPE_NB );
68
-	query_info->qclass = htons ( DNS_CLASS_IN );
69
-
70
-	/* Issue query, wait for reply */
71
-	reply = dns_query ( &query,
72
-			    ( ( ( char * ) query_info )
73
-			      + sizeof ( *query_info )
74
-			      - ( ( char * ) &query ) ),
75
-			    &nameserver );
76
-	if ( ! reply ) {
77
-		DBG ( "NMB got no response via %@ (port %d)\n",
78
-		      nameserver.sin_addr.s_addr,
79
-		      nameserver.sin_port );
80
-		return 0;
81
-	}
82
-
83
-	/* Search through response for useful answers. */
84
-	rr_info = dns_find_rr ( &query, reply );
85
-	if ( ! rr_info ) {
86
-		DBG ( "NMB got invalid response\n" );
87
-		return 0;
88
-	}
89
-
90
-	/* Check type of response */
91
-	if ( ntohs ( rr_info->type ) != DNS_TYPE_NB ) {
92
-		DBG ( "NMB got answer type %hx (wanted %hx)\n",
93
-		      ntohs ( rr_info->type ), DNS_TYPE_NB );
94
-		return 0;
95
-	}
96
-
97
-	/* Read response */
98
-	rr_info_nb = ( struct dns_rr_info_nb * ) rr_info;
99
-	*addr = rr_info_nb->nb_address;
100
-	DBG ( "NMB found address %@\n", addr->s_addr );
101
-
102
-	return 1;
103
-}
104
-
105
-struct resolver nmb_resolver __resolver = {
106
-	.name = "NMB",
107
-	.resolv = nmb_resolv,
108
-};
109
-
110
-#endif

Loading…
İptal
Kaydet