Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b8e17170
Kaydet (Commit)
b8e17170
authored
Tem 10, 2004
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[Patch #947352 from Jason Andryuk] Add support for AF_PACKET hardware addresses
üst
e6f8a89d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
socketmodule.c
Modules/socketmodule.c
+15
-6
No files found.
Modules/socketmodule.c
Dosyayı görüntüle @
b8e17170
...
@@ -50,9 +50,7 @@ Module interface:
...
@@ -50,9 +50,7 @@ Module interface:
specifying the ethernet interface and an integer specifying
specifying the ethernet interface and an integer specifying
the Ethernet protocol number to be received. For example:
the Ethernet protocol number to be received. For example:
("eth0",0x1234). Optional 3rd,4th,5th elements in the tuple
("eth0",0x1234). Optional 3rd,4th,5th elements in the tuple
specify packet-type and ha-type/addr -- these are ignored by
specify packet-type and ha-type/addr.
networking code, but accepted since they are returned by the
getsockname() method.
Local naming conventions:
Local naming conventions:
...
@@ -1223,10 +1221,12 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1223,10 +1221,12 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
int
protoNumber
;
int
protoNumber
;
int
hatype
=
0
;
int
hatype
=
0
;
int
pkttype
=
0
;
int
pkttype
=
0
;
char
*
haddr
;
char
*
haddr
=
NULL
;
unsigned
int
halen
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"si|iis"
,
&
interfaceName
,
if
(
!
PyArg_ParseTuple
(
args
,
"si|iis#"
,
&
interfaceName
,
&
protoNumber
,
&
pkttype
,
&
hatype
,
&
haddr
))
&
protoNumber
,
&
pkttype
,
&
hatype
,
&
haddr
,
&
halen
))
return
0
;
return
0
;
strncpy
(
ifr
.
ifr_name
,
interfaceName
,
sizeof
(
ifr
.
ifr_name
));
strncpy
(
ifr
.
ifr_name
,
interfaceName
,
sizeof
(
ifr
.
ifr_name
));
ifr
.
ifr_name
[(
sizeof
(
ifr
.
ifr_name
))
-
1
]
=
'\0'
;
ifr
.
ifr_name
[(
sizeof
(
ifr
.
ifr_name
))
-
1
]
=
'\0'
;
...
@@ -1240,6 +1240,15 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1240,6 +1240,15 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
addr
->
sll_ifindex
=
ifr
.
ifr_ifindex
;
addr
->
sll_ifindex
=
ifr
.
ifr_ifindex
;
addr
->
sll_pkttype
=
pkttype
;
addr
->
sll_pkttype
=
pkttype
;
addr
->
sll_hatype
=
hatype
;
addr
->
sll_hatype
=
hatype
;
if
(
halen
>
8
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Hardware address must be 8 bytes or less"
);
return
0
;
}
if
(
halen
!=
0
)
{
memcpy
(
&
addr
->
sll_addr
,
haddr
,
halen
);
}
addr
->
sll_halen
=
halen
;
*
addr_ret
=
(
struct
sockaddr
*
)
addr
;
*
addr_ret
=
(
struct
sockaddr
*
)
addr
;
*
len_ret
=
sizeof
*
addr
;
*
len_ret
=
sizeof
*
addr
;
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment